I am totally stumped with this issue and cannot really figure how to solve this problem.
Basically, I compiled the gloox library in Visual Studio 2010 (which worked totally fine with a minor tweak) and got a .lib and a .dll file. I am now trying to use this in a different program which uses a lot of gloox functionality. I am able to link most symbols fine, except one:
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" (?EmptyString@gloox@@3V?$basic_string@DU?$
char_traits@D@std@@V?$allocator@D@2@@std@@B)
When I do verbose linking of my program, I can see that all other symbols from gloox lib are being linked to fine:
1> Searching ..\..\lib\lib\gloox 1.0.lib:
1> Found "public: virtual __thiscall gloox::Message::~Message(void)" (?? 1Message@gloox@@UAE@XZ)
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 &)" (??0Message@gloox@@QAE@W4MessageType@01@ABVJID@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@222@Z)
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 *)" (?registerPresenceHandler@ClientBase@gloox@@QAEXPAVPresenceHandler@2@@Z)
1> Referenced in test.obj
1> Loaded gloox 1.0.lib(gloox 1.0.dll)
...
So I thought, may the symbol is not exported right and I did this:
dumpbin.exe /exports gloox 1.0.lib
And among other things I saw this:
??_FXHtmlIM@gloox@@QAEXXZ (public: void __thiscall gloox::XHtmlIM::`default constructor closure'(void))
?EmptyString@gloox@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B (class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const gloox::EmptyString)
?GLOOX_CAPS_NODE@gloox@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B (class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const gloox::GLOOX_CAPS_NODE)
The second line shows that the symbol has been exported fine.
Now the only difference I can think of is that the symbols being loaded correctly are all functions, and this particular one is a variable. Still, as long as its exported right, the linker should see it, right?
Any help would be greatly appreciated. If you need any more information please let me know.
Thanks!