简体   繁体   中英

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. 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! 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!

I'm trying to build assimp (latest version from GIT) using Visual Studio 2019 and the provided assimp.sln get loads of linker errors:

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

 %(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).

Any idea what could be wrong and how to fix this linker issue?

It seems to be a problem with some recent changes in assimp together with some specific Visual Studio compiler versions.

When switching back to release 5.2.0 of assimp, the code builds properly. So it is obviously caused by some of the newer changes. A bug report is filed on Github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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