-1

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?

Elmi
  • 5,899
  • 15
  • 72
  • 143
  • 1
    The preprocessor handles `#include`, and is unrelated to linking. You need to update your project linker settings to link with the actual libraries. – Some programmer dude Oct 12 '22 at 06:19
  • @Someprogrammerdude OK and what "actual libraries" are missing in my linker settings? – Elmi Oct 12 '22 at 06:27
  • 1
    How did you get to this point? What commands did you run? Did you follow the [documentation](https://github.com/assimp/assimp/blob/master/Build.md)? Please show a [mre] – Alan Birtles Oct 12 '22 at 06:55
  • How did you install the library? Does the installation have a file ending in `.lib`? Have you tried to add that to link with? – Some programmer dude Oct 12 '22 at 07:23
  • @AlanBirtles this was a working configuration. The solution/project file was created based on the documentation using the CMake-stuff. Now after upgrading to the latest version from GIT, this no longer works and causes the linker errors mentioned above – Elmi Oct 12 '22 at 08:53
  • 1
    Have you tried removing the projects and re-running cmake? I'd guess they've changed something which isn't reflected in your projects – Alan Birtles Oct 12 '22 at 09:08
  • <> - well OK, but honestly, what did you expect? I took `v5.2.5` of assimp from github and "it works on my machine". Clearing out your working directory, then git clone and recompile project from scratch is probably the best option here. And if it does not work, I bet you run into one of the "Common causes" mentioned in the dupe. For me the most common issue when working on the machine with many different lib versions installed is the conflict between headers of libv1 and shared objects of libv2. – pptaszni Oct 12 '22 at 13:30
  • @AlanBirtles recreatign the project files from CMakeLists.txt ands up with exactly the same result – Elmi Oct 17 '22 at 07:43

1 Answers1

-1

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.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Elmi
  • 5,899
  • 15
  • 72
  • 143