我正在使用 Visual C++ 2005 构建几个库和一个可执行文件。我将 STLport 位置包含在库的附加包含路径中,并将库包含在链接器的输入中以获取可执行文件。
然而,该库似乎引用了没有 stl 端口命名空间的 stl 符号(例如字符串)。这会导致链接器错误。
这些是 2 个库和可执行文件的命令行中的相关行:
/Od /I "..\Junctions\fo_fid_3rdParty\STLport-5.1.0\stlport"
/Od /I "..\Junctions\Includes\fo_fid_3rdParty\STLport-5.1.0\stlport"
/OUT:"..\ET_BUILD\vc8\Debug\bin\SFGWDealerwebFixAutorecD.exe" /INCREMENTAL:NO /NOLOGO
..\junctions\libs\fo_fid_3rdParty\STLport-5.1.0\lib\stlportstld_vc8.5.1.lib
这是一个错误示例。错误 7 错误 LNK2001: 无法解析的外部符号“public: virtual bool __thiscall Springfield::CClientFramework::ProviderRequest(class std::basic_string,class std::allocator > const &,class std::basic_string,class std::allocator > const &,class std::basic_string,class std::allocator > const &)" (?ProviderRequest@CClientFramework@Springfield@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2 @@std@@00@Z) FixAutorec.lib
这个符号 Springfield::CClientFramework::ProviderRequest 来自库 ClientArchitecture.lib 这就是 dumpbin.exe 显示这个符号的方式: (public: virtual bool __thiscall Springfield::CClientFramework::ProviderRequest(class stlpd_std::basic_string,class stlpd_std:: allocator > const &,class stlpd_std::basic_string,class stlpd_std::allocator > const &,class Springfield::IDataStoreNode const *))
请注意,正在寻找的符号定义了它的字符串 std::basic_string。而目的地将符号定义为 stlpd_std::basic_string。
谢谢