Search code examples
c++cmakeassimp

Compiling assimp from source does not generate libassimp file


So I compiled the assimp library with cmake using the x64_x86 developer command prompt that was said to be required. (When I tried using the regular console cmake did an error that it could not find 'the cl compiler').

After some time it finally compiled without errors with the following commands:

cmake CMakeLists.txt -DASSIMP_BUILD_ASSIMP_TOOLS=OFF
cmake --build .

It built 3 files:

C static library zlibstaticd.lib
CXX shared library ..\bin\assimp-vc142-mtd.dll
CXX executable ..\bin\unit.exe

But there was no libassimp.a or libassimp.so that I can link against in MinGW. I tried just linking with te dll in my own project with:

-L\"{assimp root directory}/bin\"
-lassimp-vc142-mtd

and it failed with "undefined reference to `Assimp::Importer::Importer()"

How can i get the lib file to link against?


Solution

  • I installed MSYS2, replaced my existing MinGW installation with MSYS, libraries installed flawlessly and everything works now.

    My mistake was that:

    1. I was compiling the library with VS C++ toolkit while I'm compiling my project with MInGW make and g++
    2. even after I compiled assimp the correct way, version 5.2.4 couldn't find some header, 5.2.3 and some older versions compiled successfully, but failed some unit tests (God knows why). Seemed to always hit some unresolved issue on GitHub. Never again compiling libraries from source.