Please tell me, ex'shnik after the build via Smake and mingw32-make does not start

I have Cmake and MinGW installed. Both are in variable environments. I want to build a project. I use the command cmake .. - G "MinGW Makefiles" , then run the command mingw32-make. Everything is collected, the executor appears, but does not start. Mistake: The entry point to the _ZdlPvj procedure was not found in the DLL.


CMakeLists.txt:

cmake_minimum_required(VERSION 3.0)

set(CMAKE_BUILD_TYPE Release)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall")

project(Packman)

add_executable(main main.cpp Constants.h Game.h Ghost.h ICharacter.h Packman.h 
Pellet.h setConsoleAtributes.h Game.cpp Ghost.cpp Pellet.cpp Packman.cpp 
SetConsoleAtributes.cpp)

I run it via g++ with the command: g++ - o name.exe -std=c++14 -static-libgcc -static-libstdc++ main.cpp Constants.h Game.h Ghost.h ICharacter.h Packman. h Pellet.h setconsoleattributes.h Game.cpp Ghost.cpp Pellet.cpp Packman.cpp SetConsoleAtributes.cpp and everything is collected. But it doesn't work through Cmake. Tell me, what could be the problem? I think it's in static linking, but I'm not sure. If so, how to configure it correctly via Cmake? Thank you, I will be glad of any help.

Author: yuraevo, 2020-01-26

1 answers

The error is that the program linked dynamically and searched for the necessary dlls, which it could not find. To link statically to, add set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++) to CMakeLists.txt. After that, it will run.

 0
Author: yuraevo, 2020-01-26 15:31:21