Solving "locally defined symbol" and "unresolved external symbol" that originates from the .lib files
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
Karl
Updated on June 05, 2022Comments
-
Karl almost 2 years
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<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) imported ... ... 1>gdcmMSFF.lib(gdcmCurve.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > 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<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > 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?
-
Karl over 13 yearsPutting that in does not help at all.
-
Thelema about 6 yearsLink is dead; need better reference.
-
engf-010 about 6 years@Thelema: those thing happen (it's been 7 years). That's why the essence of the article is in the first line of my answer ,which seems to have solved OPs problem. Apologies for not going to spend (valuable) time on this any further.