简体   繁体   English

如何摆脱 assimp linker 错误?

[英]How to get rid of assimp linker errors?

Note for the people that close questions without understanding the problem: I know what an linker error is.请注意那些在不了解问题的情况下关闭问题的人:我知道 linker 错误是什么。 My problem is not the GENERIC question, what a linker error is, my problem is, specific to Assimp missing some things which should be there!我的问题不是 GENERIC 问题,linker 错误是什么,我的问题是,特定于 Assimp 缺少一些应该存在的东西! So please do not close this question as "duplicate" as is it an Assimp-specific question and not some random "my stuff is not linking" question!所以请不要将这个问题作为“重复”关闭,因为它是一个特定于 Assimp 的问题,而不是一些随机的“我的东西没有链接”的问题!

I'm trying to build assimp (latest version from GIT) using Visual Studio 2019 and the provided assimp.sln get loads of linker errors:我正在尝试使用 Visual Studio 2019 构建 assimp(来自 GIT 的最新版本),并且提供的 assimp.sln 收到大量 linker 错误:

LNK2001 unresolved external symbol "public: __cdecl aiVector3t<float>::aiVector3t<float>(class aiVector3t<float> const &)" (??0?$aiVector3t@M@@QEAA@AEBV0@@Z)   assimp  F:\wxWidgets-3\demos\assimp\code\Importer.obj   1   
LNK2001 unresolved external symbol "public: __cdecl aiColor4t<float>::aiColor4t<float>(class aiColor4t<float> const &)" (??0?$aiColor4t@M@@QEAA@AEBV0@@Z)   assimp  F:\wxWidgets-3\demos\assimp\code\X3DImporter_Rendering.obj  1   
LNK2001 unresolved external symbol "public: __cdecl aiVector2t<float>::aiVector2t<float>(class aiVector2t<float> const &)" (??0?$aiVector2t@M@@QEAA@AEBV0@@Z)   assimp  F:\wxWidgets-3\demos\assimp\code\XmlSerializer.obj  1   
LNK2019 unresolved external symbol "public: __cdecl aiVector3t<float>::aiVector3t<float>(class aiVector3t<float> const &)" (??0?$aiVector3t@M@@QEAA@AEBV0@@Z) referenced in function "public: struct aiFace * __cdecl std::vector<struct aiFace,class std::allocator<struct aiFace> >::_Emplace_reallocate<struct aiFace const &>(struct aiFace * const,struct aiFace const &)" (??$_Emplace_reallocate@AEBUaiFace@@@?$vector@UaiFace@@V?$allocator@UaiFace@@@std@@@std@@QEAAPEAUaiFace@@QEAU2@AEBU2@@Z)    assimp  F:\wxWidgets-3\demos\assimp\code\X3DGeoHelper.obj   1   
LNK2019 unresolved external symbol "public: __cdecl aiVector2t<double>::aiVector2t<double>(class aiVector2t<double> const &)" (??0?$aiVector2t@N@@QEAA@AEBV0@@Z) referenced in function "private: void __cdecl std::deque<class aiVector2t<double>,class std::allocator<class aiVector2t<double> > >::_Emplace_back_internal<class aiVector2t<double> const &>(class aiVector2t<double> const &)" (??$_Emplace_back_internal@AEBV?$aiVector2t@N@@@?$deque@V?$aiVector2t@N@@V?$allocator@V?$aiVector2t@N@@@std@@@std@@AEAAXAEBV?$aiVector2t@N@@@Z)   assimp  F:\wxWidgets-3\demos\assimp\code\IFCOpenings.obj    1   

VS builds in C++17 mode and with the preprocessor options VS 以 C++17 模式和预处理器选项构建

 %(PreprocessorDefinitions);WIN32;_WINDOWS;NDEBUG;ASSIMP_BUILD_DLL_EXPORT;ASSIMP_BUILD_NO_M3D_IMPORTER;ASSIMP_BUILD_NO_M3D_EXPORTER;WIN32_LEAN_AND_MEAN;UNICODE;_UNICODE;ASSIMP_BUILD_NO_EXPORT;ASSIMP_BUILD_NO_C4D_IMPORTER;ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1;RAPIDJSON_HAS_STDSTRING=1;RAPIDJSON_NOMEMBERITERATORCLASS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;OPENDDLPARSER_BUILD;CMAKE_INTDIR="Release";assimp_EXPORTS

The related headers/classes of the objects missing during linking are there and are built within the same project (at least as I can see, I'm not sure regarding all this template stuff used there if for some reason specifically the objects complained in the linker errors are not built).链接期间丢失的对象的相关标头/类在那里并且是在同一个项目中构建的(至少如我所见,如果出于某种原因特别是在linker 错误未构建)。

Any idea what could be wrong and how to fix this linker issue?知道可能出什么问题以及如何解决这个 linker 问题吗?

It seems to be a problem with some recent changes in assimp together with some specific Visual Studio compiler versions. assimp 的一些最新更改以及某些特定的 Visual Studio 编译器版本似乎是一个问题。

When switching back to release 5.2.0 of assimp, the code builds properly.当切换回 assimp 5.2.0 版时,代码构建正确。 So it is obviously caused by some of the newer changes.所以这显然是由一些较新的变化引起的。 A bug report is filed on Github.错误报告已在 Github 上提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM