Solving the "locally defined character" and the "unresolved external character" that comes from .lib files

I am trying to compile my project with the open source GDCM library on Visual C ++ 2010 on a 64-bit version of Windows 7. I have included the required .lib files (gdcmDSED.lib and gdcmMSFF.lib) in the project, however, the compiler complains about more than 100 unsolved external errors. But I see some error patterns. 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) 

This is 1 warning and 2 errors out of a total of 100. This is for better clarification. I see that the compiler complains about all these warnings and errors, either about a "locally defined character" and an "unresolved external character". Furthermore, it seems that the error comes from the .lib files themselves (not from [my project name] .obj), as you can see above.

I tried to include all .lib libraries from the library, but this does not seem to solve the problem. Even worse, the compiler displays more of the same warnings and errors.

Did I forget something? What should I do to solve this problem?

+3
source share
2 answers

This is discovered on the Internet: problems disappear when creating a gdcm DLL using BUILD_SHARED_LIBS enabled.

Does this ring a bell?

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

+2
source

This basic_string requires #include <string>, have you tried this?

-2
source

Source: https://habr.com/ru/post/1411431/


All Articles