assimp cmake mingw-w64 VSCode win10

问题描述 投票:0回答:1

我正在尝试在opengl中使用assimp,请按照以下此处的构建说明进行操作:在以下环境下为https://github.com/assimp/assimp/blob/master/Build.md

assimp 5.0.1    
cmake 3.17.2
mingw-w64 with gcc/g++ 8.1.0
VSCode in Win10

我在cmake-gui中尝试过,使用MinGW Makefile,我可以在构建路径中获取一个makefile。

然后我尝试通过mingw32-make使其成功,并使用]停在69%位置>

[ 67%] Linking CXX shared library libassimp.dll
[ 67%] Built target assimp
Scanning dependencies of target assimp_cmd
[ 67%] Building RC object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/assimp_cmd.rc.obj
[ 68%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/CompareDump.cpp.obj
[ 68%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/ImageExtractor.cpp.obj
[ 68%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/Main.cpp.obj
[ 68%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/WriteDumb.cpp.obj
[ 69%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/Info.cpp.obj
[ 69%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/Export.cpp.obj
[ 69%] Linking CXX executable assimp.exe
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x8d): undefined reference to `Assimp::Importer::ValidateFlags(unsigned int) const'
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0xc4): undefined reference to `Assimp::Importer::ReadFile(char const*, unsigned int)'
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x14e): undefined reference to `Assimp::DefaultLogger::create(char const*, Assimp::Logger::LogSeverity, unsigned int, Assimp::IOSystem*)'
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x183): undefined reference to `Assimp::DefaultLogger::kill()'
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x1b8): undefined reference to `Assimp::Importer::GetErrorString() const'
......
......
......
CMakeFiles\assimp_cmd.dir/objects.a(Export.cpp.obj):Export.cpp:(.text+0xf44): undefined reference to `Assimp::Exporter::GetExportFormatDescription(unsigned long long) const'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [tools\assimp_cmd\CMakeFiles\assimp_cmd.dir\build.make:197: tools/assimp_cmd/assimp.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:297: tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/all] Error 2
mingw32-make: *** [Makefile:149: all] Error 2

尽管我可以在构建目录中获得一个“ libassimp.dll”和一个“ libassimp.dll.a”,但是我无法将它们链接到我的项目中。有许多“未定义的对xxxx的引用”错误。

  1. 我将.dll放在exe路径中,将.a文件放在lib路径中,所有assimp .h文件都放在了include路径中。
  2. VSCode似乎不支持文件名“ libassimp.dll.a”,我必须将其重命名为libassimpdll.a,并在task.json中写入“ -lassimp”。但是存在“未定义的引用”错误。
  3. 我试图为VS2017构建asimp,并且我可以获取dll和lib。
  4. 我试图直接链接asimp 3.1.1(已正式提供x86 / x64 dll和lib),但也失败了。
  5. 所以我的问题是如果有人成功用cmake和mingw-w64构建asimp并将其链接到VSCode Win10中的项目中?

我正在尝试在opengl中使用assimp,请遵循以下构建说明:https://github.com/assimp/assimp/blob/master/Build.md在以下环境下:assimp 5.0.1 cmake 3.17.2 mingw -...

opengl visual-studio-code windows-10 mingw-w64 assimp
1个回答
0
投票

我可以使用以下命令构建asimp 5.0.1:>

cmake.exe -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DASSIMP_BUILD_TESTS:BOOL=OFF -DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=OFF -DASSIMP_HEADERCHECK:BOOL=OFF -DASSIMP_OPT_BUILD_PACKAGES:BOOL=OFF -DSYSTEM_IRRXML:BOOL=OFF -DASSIMP_BUILD_SAMPLES:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DASSIMP_BUILD_TESTS:BOOL=OFF
© www.soinside.com 2019 - 2024. All rights reserved.