Monday, 28 August 2017

c++ - Solving "locally defined symbol" and "unresolved external symbol" that originates from the .lib files



I am trying to compile my project with an open source library GDCM on Visual C++ 2010 on Windows 7 64 bits. I have included required .lib files (gdcmDSED.lib and gdcmMSFF.lib) in my project, however, the compiler complains back more than 100 unresolved external errors. But I see some patterns in the errors. Here:



1>gdcmDSED.lib(gdcmSequenceOfItems.obj) : warning LNK4049: locally defined symbol ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string,class std::allocator >::~basic_string,class std::allocator >(void)) imported
...
...
1>gdcmMSFF.lib(gdcmCurve.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string,class std::allocator >::basic_string,class std::allocator >(class std::basic_string,class std::allocator > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
1>gdcmDSED.lib(gdcmCSAHeader.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string,class std::allocator >::basic_string,class std::allocator >(class std::basic_string,class std::allocator > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)



These are 1 warning and 2 errors from total 100. This is for better clarification. I can see that the compiler complains all these warnings and errors, either about "locally defined symbol" and "unresolved external symbol". Moreover, it seems that the error originates from the .lib files themselves (not from [my project's name].obj), as you can see above.



I have tried include all the .lib files from the library, but that does not seem to solve it. Worse, the compiler outputs more of the same warnings and errors.



Am I forgetting something here? What must I do in order to solve this problem?


Answer



Found this on the internet : The problems disappear when creating the gdcm DLL with the
BUILD_SHARED_LIBS ON.




Does this ring a bell ?



see: http://www.creatis.insa-lyon.fr/pipermail/dcmlib/2007-April.txt


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...