我完全不知道如何解决此问题。XMPP客户端库gloox - 链接器找不到符号
基本上,我在Visual Studio 2010中编译了gloox库(它在一个小的调整中工作得很好),并且得到了一个.lib和一个.dll文件。我现在试图在一个使用了很多gloox功能的不同程序中使用它。我能大多数符号链接很好,除了一个:
1>test.obj : error LNK2001: unresolved external symbol "class
std::basic_string<char,struct std::char_traits<char>,
class std::allocator<char> >
const gloox::EmptyString" ([email protected]@@[email protected]?$
[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@B)
当我做我的程序的详细链接,我可以看到,从gloox lib中所有其他符号如链接到罚款:
1> Searching ..\..\lib\lib\gloox 1.0.lib:
1> Found "public: virtual __thiscall gloox::Message::~Message(void)" (?? [email protected]@@[email protected])
1> Referenced in test.obj
1> Loaded gloox 1.0.lib(gloox 1.0.dll)
1> Found "public: __thiscall gloox::Message::Message(enum gloox::Message::MessageType,class gloox::JID const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@@[email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected])
1> Referenced in test.obj
1> Loaded gloox 1.0.lib(gloox 1.0.dll)
1> Found "public: void __thiscall gloox::ClientBase::registerPresenceHandler(class gloox::PresenceHandler *)" ([email protected]@[email protected]@[email protected]@@Z)
1> Referenced in test.obj
1> Loaded gloox 1.0.lib(gloox 1.0.dll)
...
因此,我认为,可以将符号不正确的出口,我这样做:
DUMPBIN.EXE /出口gloox 1.0.lib
而且除其他事项外,我看到这样的:
??_FXHtm[email protected]@@QAEXXZ (public: void __thiscall gloox::XHtmlIM::`default constructor closure'(void))
[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@B (class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const gloox::EmptyString)
[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@B (class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const gloox::GLOOX_CAPS_NODE)
第二行显示的符号已经导出的罚款。
现在我能想到的唯一区别是正确加载的符号都是函数,而这个特定的符号是一个变量。不过,只要它的出口权,链接器应该看到它,对吧?
任何帮助将不胜感激。如果您需要更多信息,请告诉我。
谢谢!
对不起,没有看到这个。这看起来像解决此问题的一种方法。但它仍然无法解释为什么这个问题首先存在。 – verma