I have a game in SFML and built it using cmake. Now I would like to create an executable for the game. To achieve it I have built it in release mode and got the cmake-build-release directory, where I found the executable.
But when I run the executable file in cmake-build-releasebin it throws 2 sequential “Entry Point Not Found” popup windows which says:
- “Couldn’t locate an entry point for procedure _ZNSt7_cxx1112basic_stringlcSt11 char_traitslcESalcEE15_M_replace_c oldEPcуPKcуy not found in library …/cmake-build-release/bin/sfml-graphics-2.dll”.
- “Couldn’t locate an entry point for procedure … not found in library …/cmake-build-release/bin/sfml-window-2.dll”
I have all of my dll files in the directory with the executable.
When I build and run the program through CLion it runs without any issues.
I am using CLion with the bundled MinGW toolset, gcc/g++ compiler.
This is how my CMakeLists.txt looks like:
cmake_minimum_required(VERSION 3.27)
project(MagicianFest)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include(FetchContent)
FetchContent_Declare(
SFML
GIT_REPOSITORY https://github.com/SFML/SFML
GIT_TAG 2.6.1
)
FetchContent_MakeAvailable(SFML)
add_executable(...)
target_link_libraries(MagicianFest sfml-graphics sfml-system sfml-window sfml-network sfml-audio)
My goal is to create an executable file, so maybe there is a different approach to achieve this. I am open to all kind of suggestions.
9
In the end it turned out to be the problem with the mixed compilers. I found out through using dependency walker on the executable that there was a MSVCRT.dll, which, I guess, meant that program was using msvc compiler, which lead me to not using the default MinGW toolset with its g++ compiler, but the Visual Studio Toolset (with cl.exe) which I had already downloaded before.
Solution: I just change the default MinGW toolset to Visual Studio Toolset int the CLion settings and built this way.
Now the executable file which is located in the cmake-build-debug-visual-studio folder works without flaws.