Archived

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

Linker Error for simple Ice program

Hi, I'm making a simple server program and I got these lines from the linker and it looks like its something about the code you guys write:
1>Messager.obj : warning LNK4248: unresolved typeref token(01000013)(为“IceInternal.RequestHandler”);image may not run
1>stdafx.obj : warning LNK4248: unresolved typeref token(0100001C)(为“IceInternal.Reference”);image may not run
1>stdafx.obj : warning LNK4248: unresolved typeref token(01000020)(为“IceInternal.ObjectFactoryManager”);image may not run
1>stdafx.obj : error LNK2028: unresolved token(0A000A8C) "class IceUtil::Shared * __cdecl IceInternal::upCast(class IceInternal::ObjectFactoryManager *)" (?upCast@IceInternal@@$$FYAPAVShared@IceUtil@@PAVObjectFactoryManager@1@@Z)&#65292;referenced in function "public: __thiscall IceInternal::Handle<class IceInternal::ObjectFactoryManager>::Handle<class IceInternal::ObjectFactoryManager>(class IceInternal::Handle<class IceInternal::ObjectFactoryManager> const &)" (??0?$Handle@VObjectFactoryManager@IceInternal@@@IceInternal@@$$FQAE@ABV01@@Z) 
1>stdafx.obj : error LNK2019: unresolved symbol "class IceUtil::Shared * __cdecl IceInternal::upCast(class IceInternal::ObjectFactoryManager *)" (?upCast@IceInternal@@$$FYAPAVShared@IceUtil@@PAVObjectFactoryManager@1@@Z)&#65292;referenced in function "public: __thiscall IceInternal::Handle<class IceInternal::ObjectFactoryManager>::Handle<class IceInternal::ObjectFactoryManager>(class IceInternal::Handle<class IceInternal::ObjectFactoryManager> const &)" (??0?$Handle@VObjectFactoryManager@IceInternal@@@IceInternal@@$$FQAE@ABV01@@Z) 
1>C:\Users\Administrator\documents\visual studio 2010\Projects\LearnIceServer\Debug\LearnIceServer.exe : fatal error LNK1120: 2 unresolved externals

I'm using MSVC++ 2010 and I'm including and importing all the .h's and .lib's I can.
And I'm using Ice-3.5.0
Can anyone help me? Thank you very much!

I tried to work around this problem by including every header file in Ice-3.5.0/include, and then it's giving me that it needs "iconv.h". After a little researching on Internet I figured that libiconv is for GNU. If I got it right, I thought that Ice is built on MS compilers and it is not compatible with GNU compilers and these compilers. Can anyone help me out of this?
And if I comment out the line that includes iconv.h, it reports me that winsock.h is redefining tons of constants that is previously defined by ws2def.h. I figured that if I continue on this road (including all files no matter I need it or not) it is going to be so much more problems than I need.

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Don't include all the headers from the include directory, as you discovered this doesn't work :).

    You should just need to include <Ice/Ice.h>. Can you copy/paste the linker command used to link your executable? You should add iceutil.lib and ice.lib if you build with the release C++ runtime (/MD linker option) or iceutild.lib and iced.lib if you build with the C++ debug runtime (/MDd linker option)

    As recommended in my other post, I recommend that you first try out the demos and look at how the demos are built with Visual Studio and eventually re-use one of the project from a demo to start with your sample program.

    Note also that if you use Visual Studio to build your program, the Visual Studio add-in will automatically setup the build options to use the correct Ice libraries.

    Cheers,
    Benoit.