-1

All goes well the the compiling cmake .. -G "MinGW Makefiles" and the "making" mingw32-make.exe. The problem arises when I try to run the exe - windows gives me this error message:

The procedure entry point
_ZNKSt10filesystem7_cxx1118directory_iteratordeEv could not be located in the dynamic link library ****\anamorph_movie.exe.`

(stars represent path to build folder)

I've tried modifying my compiler/linker flags as mentioned in many posts (see my CMakeLists.txt):

cmake_minimum_required(VERSION 3.1)
project(anamorph_movie)
SET(GCC_COVERAGE_COMPILE_FLAGS "-static-libgcc")
SET(GCC_COVERAGE_COMPILE_FLAGS "-static-libgcc++")

# Set the C++ standard to C++17
set(CMAKE_CXX_STANDARD 17)


# include the vcg library
include_directories(./lib/vcglib-main/)
# include the eigen library
include_directories(./lib/vcglib-main/eigenlib)
include_directories(C:/msys64/mingw64/bin)
include_directories(C:/msys64/mingw64/lib)

# Add your executable and source files here
add_executable(${PROJECT_NAME} anamorph_video_commandline.cpp)
target_link_libraries(${PROJECT_NAME} stdc++fs)

I also tried using include_directories as you can probably see (if this is bad practise forgive me)

I also tried moving my exe into my C:\msys64\mingw64\bin folder - also didn't work.

I also tried moving my path variable to the top of this list (don't know why I thought this would work but worth a shot)

I tried pacman -Suy and observe no difference.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
Cosmo
  • 1
  • 2
  • First time working with CMake? I can see many issues in your CmakeLists.txt. – kiner_shah Feb 27 '23 at 06:55
  • Have you checked other questions on Stack Overflow with the similar error message? E.g. [that one](https://stackoverflow.com/q/54386599/3440745). – Tsyvarev Feb 27 '23 at 07:04
  • Use target_include_directories instead and that should be set to path where header files are stored, not bin folder not lib folder. Also, why do you have two lines for setting `GCC_COVERAGE_COMPILE_FLAGS`? Did you mean to set `GCC_COVERAGE_LINK_FLAGS` after compile flags? – kiner_shah Feb 27 '23 at 07:20
  • Do you have more than one MinGW version installed? There might be interference. – HolyBlackCat Feb 27 '23 at 07:21

1 Answers1

0

Thanks everyone for the help! The solution was painfully simple: Instead of generating with cmake .. -G "MinGW Makefiles", I used cmake .. -G "MSYS Makefiles". After which I ran mingw32-make. I can't give an explanation to why this worked just happy it did!

This is what my CMakeLists.txt looked like at the end

cmake_minimum_required(VERSION 3.1)
project(anamorph_movie)

# Set the C++ standard to C++17
set(CMAKE_CXX_STANDARD 17)


# include the vcg library
include_directories(./lib/vcglib-main/)
# include the eigen library
include_directories(./lib/vcglib-main/eigenlib)

# Add your executable and source files here
add_executable(${PROJECT_NAME} anamorph_video_commandline.cpp)
target_link_libraries(${PROJECT_NAME} stdc++fs)
Cosmo
  • 1
  • 2
  • The standard way used to be `-G "MSYS Makefiles` and then a plain old `make` command. Now in MSYS2 the default CMake generator is actually Ninja, so you can just leave off the whole `-G` thing, and then build your project with `cmake --build .` or `ninja`. – David Grayson Feb 27 '23 at 17:24