This forum has been archived. Please start a new discussion on GitHub.

Unresolved external symbol error at linking

Hi, I need your help.

I have a very large Qt project for hosts' system monitoring, singnal processing of server hardware and etc. Now I want to refuse use of SNMP and FTP and replace it by ICE.
There are no problem to use ICE with Microsoft Visual Studio + Your AddIn. But not everything is so good with Qt (Microsoft Visual Studio (x86) compiler, not minGW).
I can't compile and link small ICE project (hello world) because of unresolved external symbol error at linking like this:
moc_iceclient.obj:-1: error: LNK2001: unresolved external symbol ""public: virtual __thiscall IClient::IceClient::~IceClient(void)" (??1IceClient@IClient@@UAE@XZ)"
iceclient.obj:-1: error: LNK2019: unresolved external symbol reference "class IceProxy::Ice::Object * __cdecl IceProxy::Server::upCast(class IceProxy::Server::AbstractServer *)" (?upCast@Server@IceProxy@@YAPAVObject@Ice@2@PAVAbstractServer@12@@Z) &#1074; &#1092;&#1091;&#1085;&#1082;&#1094;&#1080;&#1080; "public: __thiscall IceInternal::ProxyHandle<class IceProxy::Server::AbstractServer>::ProxyHandle<class IceProxy::Server::AbstractServer>(class IceProxy::Server::AbstractServer *)" (??0?$ProxyHandle@VAbstractServer@Server@IceProxy@@@IceInternal@@QAE@PAVAbstractServer@Server@IceProxy@@@Z)
iceclient.obj:-1: error: LNK2001: unresolved external symbol ""private: virtual class IceInternal::Handle<class IceDelegateD::Ice::Object> __thiscall IceProxy::Server::AbstractServer::__createDelegateD(void)" (?__createDelegateD@AbstractServer@Server@IceProxy@@EAE?AV?$Handle@VObject@Ice@IceDelegateD@@@IceInternal@@XZ)"
and etc...
I include ice.lib and iceutil.lib different ways:
win32 {
   CONFIG(debug, debug|release):     LIBS += "C:/Ice-3.5.0/lib/iced.lib" \
   CONFIG(release, debug|release):   LIBS += "C:/Ice-3.5.0/lib/ice.lib" \
win32:CONFIG(release, debug|release): LIBS *= -LC:/Ice-3.5.0/lib/ -lice -liceutil
else:win32:CONFIG(debug, debug|release): LIBS *= -LC:/Ice-3.5.0/lib/ -liced -liceutild
#pragma comment (lib,"C:/Ice-3.5.0/lib/iced.lib")
#pragma comment (lib,"C:/Ice-3.5.0/lib/iceutild.lib")
But unresolved symbol errors remain...

What can I do to proper linking ice libraries?

Aleksey Blokhin

P.S: And sorry for my bad English, it's not my native language


  • benoit
    benoit Rennes, France

    The linker errors point to missing symbols which aren't symbols from the Ice library:
    IceProxy::Server::upCast(class IceProxy::Server::AbstractServer *)

    Did you perhaps simply forget to add the object(s) for the code generated by the Slice compiler?

  • OMG! Really! Now it works! So much sleepless nights because of it... I just included slice-generated file by #include "abstractserver.h", while it was at the subdir and wasn't found (it's a mystery for me why it wasn't error that file just wasn't found).

    Benoit, thanks a lot for ur help!