使用/MD为窗口构建assimp



是否可以使用/MD为windows构建assimp?我试过以下几种:

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="/MD" ..

CMake运行完成。但是在编译过程中,几乎每个组件都失败得很惨。我试图将assimp链接到的客户端库使用/MD,所以我也想将/MD用于assimp,以避免出现问题。

编辑

以下是一些编译日志:

5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): error C2220: the following warning is treated as an error (compiling source file C:pathtoWorkspaceassimpcodeCommonImporterRegistry.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (compiling source file C:pathtoWorkspaceassimpcodeCommonImporterRegistry.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): error C2220: the following warning is treated as an error (compiling source file C:pathtoWorkspaceassimpcodeCommonAssimp.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (compiling source file C:pathtoWorkspaceassimpcodeCommonAssimp.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): error C2220: the following warning is treated as an error (compiling source file C:pathtoWorkspaceassimpcodeCommonZipArchiveIOSystem.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (compiling source file C:pathtoWorkspaceassimpcodeCommonZipArchiveIOSystem.cpp)
5>ScenePreprocessor.cpp
5>C:pathtoWorkspaceassimpincludeassimp/Exceptional.h(123,1): error C2220: the following warning is treated as an error (compiling source file C:pathtoWorkspaceassimpcodeCommonBaseImporter.cpp)
5>C:pathtoWorkspaceassimpincludeassimp/Exceptional.h(123,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (compiling source file C:pathtoWorkspaceassimpcodeCommonBaseImporter.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): error C2220: the following warning is treated as an error (compiling source file C:pathtoWorkspaceassimpcodeCommonBaseProcess.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (compiling source file C:pathtoWorkspaceassimpcodeCommonBaseProcess.cpp)
5>SkeletonMeshBuilder.cpp
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): error C2220: the following warning is treated as an error (compiling source file C:pathtoWorkspaceassimpcodeCommonPostStepRegistry.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (compiling source file C:pathtoWorkspaceassimpcodeCommonPostStepRegistry.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): error C2220: the following warning is treated as an error (compiling source file C:pathtoWorkspaceassimpcodeCommonImporter.cpp)
5>C:pathtoWorkspaceassimpincludeassimpExceptional.h(123,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (compiling source file C:pathtoWorkspaceassimpcodeCommonImporter.cpp)
5>C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.29.30037includevector(1309,1): error C2220: the following warning is treated as an error (compiling source file 
C:pathtoWorkspaceassimpcodeCommonSpatialSort.cpp)
5>C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.29.30037includevector(1299): message : while compiling class template member function 'void std::vector<Assimp::SpatialSort::Entry,std::allocator<Assimp::SpatialSort::Entry>>::_Reallocate_exactly(const unsigned __int64)' (compiling source file 
C:pathtoWorkspaceassimpcodeCommonSpatialSort.cpp)
5>C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.29.30037includevector(1376): message : see reference to function template instantiation 'void std::vector<Assimp::SpatialSort::Entry,std::allocator<Assimp::SpatialSort::Entry>>::_Reallocate_exactly(const unsigned __int64)' being compiled (compiling source file C:pathtoWorkspaceassimpcodeCommonSpatialSort.cpp)
5>C:pathtoWorkspaceassimpincludeassimp/SpatialSort.h(170): message : see reference to class template instantiation 'std::vector<Assimp::SpatialSort::Entry,std::allocator<Assimp::SpatialSort::Entry>>' being compiled (compiling source file C:pathtoWorkspaceassimpcodeCommonSpatialSort.cpp)
5>C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.29.30037includevector(1309,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (compiling source file C:pathtoWorkspaceassimpcodeCommonSpatialSort.cpp)

第一批共309个错误。

您需要禁用编译器获取的CMakeLists.txt中的WX选项。默认情况下启用此选项。也许我们应该考虑提供一个选项来禁用它。

最新更新