mingw 編譯 assimp v6.0.2
理論上看這個就能滿足:在Windows下使用CMake+MinGW64編譯Assimp庫
環境變量問題
i386 architecture of input file `CMakeFiles\assimp.dir/objects.a(assimp.rc.obj)’ is incompatible with i386:x86-64 output collect2.exe: error: ld returned 1 exit status
1、 編譯報錯
assimp\code\AssetLib\X3D\X3DGeoHelper.cpp:
In static member function ‘static void Assimp::X3DGeoHelper::coordIdx_str2lines_arr(const std::vector&, std::vector&)’:
assimp\code\AssetLib\X3D\X3DGeoHelper.cpp:194:20:
error: array subscript -1 is outside array bounds of ‘int [2305843009213693951]’ [-Werror=array-bounds=]
194 | if (f_data.back() != (-1)) {
| ~~~~~~~~~~~^~
修改 assimp\code\AssetLib\X3D\X3DGeoHelper.cpp:194:20
2、cmake_rc_compiler沒修改成功
原:
改為和指定的g++.exe 同目錄下的windres.exe
注意:如果configure 后修改cmake_rc_compiler沒修改成功 或者 其他路徑改變(CMAKE_CXX_COMPILER、CMAKE_C_COMPILER)不是指定的g++.exe,需要左上角File->Delete Cache,退出重啟軟件,部分機器需要重啟(特別是有多個MingW/g++必須重啟)
3、#pragma warning
指令時產生報錯
使用 mingw64/bin/g++.exe 一般不會出現此問題
使用 mingw64/bin/x86_64-w64-mingw32-g++.exe 目前的確會出現此問題
取消勾選ASSIMP_WARNINGS_AS_ERROR
4、cc1.exe: fatal error
cc1.exe: fatal error: Files: No such file or directory
compilation terminated.
安裝路徑是中文/ 上級文件夾名稱有空格(默認Microsoft DirectX SDK (June 2010)有空格沒問題 系統會獲取短路徑名MICROS~1)