Создайте assimp для Windows с помощью /MD

#c #windows #assimp

Вопрос:

Можно ли создать assimp для Windows с помощью /MD? Я попробовал следующее:

 mkdir build amp;amp; 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 общих ошибок.

Комментарии:

1. «… почти каждый компонент с треском выходит из строя…» как мы должны помочь ? Пожалуйста, укажите примеры ошибок в вопросе.

2. Ничего общего с /MD тем, что вам нужно включить обработку исключений C /EHsc , она включена по умолчанию, поэтому сначала проверьте, почему она была отключена. docs.microsoft.com/en-us/cpp/build/reference/…

3. Так что добавление /EHsc сделало свое дело. Не знаю, почему он выключен. Без флага /MD все также работает.

Ответ №1:

Вам необходимо отключить опцию WX в CMakeLists.txt получил твой компилятор. По умолчанию эта опция включена. Может быть, нам следует подумать о том, чтобы предложить возможность отключить это.