Search code examples
c++cmakemingwclion

Clion, CMake undefined reference to functions from libraries


I am trying to use assimp on windows using CLion, but when I try to use the functions provided, I am met with

undefined reference to 'Assimp::Importer::ReadFile(char const*, unsigned int)'

error.

My current cmake.txt links the library like so:

    find_package(assimp REQUIRED)

    target_link_libraries(${PROJECT_NAME} assimp::assimp)

The assimp package was also installed using CLion's vcpkg.
The version of MinGW I'm trying to run on is 6.0, but 11.0 doesn't work either.


Solution

  • So after about a day of fiddling with this, I found out that assimp (probably) doesn't support mingw on windows.

    ref:

    The "fix":

    In the end I changed the compiler from MinGW to VS2022 (visual studio 2022).

    Thank you all for the help!

    edit: From what a friend told me, he got it working with MinGW after building with clang.