3

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
  • 5,613
  • 13
  • 73
  • 107
  • Are you including your lib files as dependency lib files or not ? It is not enough giving the location of lib files. You have to include the dependency in your project settings. – DumbCoder Jan 21 '11 at 11:08
  • If you mean, putting the name of the libs into the linker, then I have already done that. – Karl Jan 21 '11 at 11:44

2 Answers2

2

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

engf-010
  • 3,980
  • 1
  • 14
  • 25
  • Link is dead; need better reference. – Thelema Mar 16 '18 at 23:13
  • @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. – engf-010 Mar 16 '18 at 23:28
-2

That basic_string needs #include <string>, have you tried that?

Dave
  • 3,438
  • 20
  • 13