Win10下VSCode中CMake+MinGW-w64编译Assimp并链接的问题求助
Hey folks,
First, I wanted to flag a known bug I ran into with newer Assimp versions:
- Assimp 5.2.5 compiles successfully with MinGW-w64 (gcc 12.2.0) if you disable the
ASSIMP_WARNING_AS_ERRORCMake option. But it can't load .obj models that worked perfectly with MSVC-built Assimp—my OpenGL scene just doesn't render the models at all. The Assimp dev team has confirmed this issue and has it on their backlog for the 5.1 release.
Now, onto my own problem that I'm stuck on:
My Environment & Troubleshooting Steps
I'm on Windows 10 using VSCode, trying to integrate Assimp 5.0.1 with OpenGL. My setup includes:
- CMake 3.17.2
- MinGW-w64 (gcc/g++ 8.1.0)
I followed the official build instructions to generate MinGW Makefiles via CMake-GUI, but when I ran mingw32-make, the process failed at the 69% stage with a bunch of undefined reference linking errors. It didn't produce the assimp.exe binary, but I did end up with libassimp.dll and libassimp.dll.a in my build directory.
I tried all the standard linking steps:
- Placed
libassimp.dllin my project's executable output path - Added the directory with
libassimp.dll.ato my library path - Included the Assimp header directories in my include path
- Renamed
libassimp.dll.atolibassimpdll.a(to fit VSCode's linker expectations) and added-lassimpto mytasks.jsonlinker flags
But no luck—I'm still getting tons of undefined reference errors when building my project. I also tested other approaches:
- Compiling Assimp with VS2017 works flawlessly, producing valid dll and lib files
- Linking the official precompiled Assimp 3.1.1 library also resulted in the same linking errors
Asking for Help
Has anyone out there managed to successfully compile Assimp using CMake + MinGW-w64 on Windows 10 with VSCode, and get it properly linked into an OpenGL project? Any tips or workarounds would be hugely appreciated!
内容的提问来源于stack exchange,提问作者abmin

