我正在尝试在 Windows 7 64 位上的 Visual C++ 2010 上使用开源库 GDCM 编译我的项目。我已在我的项目中包含了所需的 .lib 文件(gdcmDSED.lib 和 gdcmMSFF.lib),但是,编译器抱怨超过 100 个未解决的外部错误。但我在错误中看到了一些模式。这里:
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)
总共 100 个错误中有 1 个警告和 2 个错误。这是为了更好地说明。我可以看到编译器抱怨所有这些警告和错误,无论是关于“本地定义的符号”还是“未解析的外部符号”。此外,该错误似乎源自 .lib 文件本身(而不是来自 [我的项目名称].obj),如您在上面所看到的。
我尝试包含库中的所有 .lib 文件,但这似乎并不能解决问题。更糟糕的是,编译器会输出更多相同的警告和错误。
我在这里忘记了什么吗?为了解决这个问题我必须做什么?