Archived

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

Ice 3.0.1 & Visual Studio 2005 (Express edition)

Hello,
I tried to move my development from linux to windows in order to work with another C++ IDE than suits better my needs than KDevelop (except Eclipse), and I'm using the new Visual Studio 2005 express edition, that is free of charge.

With the package downladable from the ZeroC website, with all the PATH set properly and with the right directories set in the properties of VS, I'm able to compile without errors all the demos included in the package.
The problem comes when I want to create a new project for example called ChatClient, which has the same sources as ChatC just to learn the usage of VS with Ice. Consider that the "Custom build step" for the file .ice is correctly set.

In the linking phase I get this kind of error (several times):
Client.obj : error LNK2005: "void __cdecl IceInternal::incRef(class Demo::ChatCallback *)" (?incRef@IceInternal@@Z) already defined in Chat.obj

...and these errors (again...several times):
Chat.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall IceProxy::Glacier2::Session::Session(void)" (__imp_??0Session@Glacier2@IceProxy@@QAE@XZ) referenced in function "public: __thiscall IceProxy::Demo::ChatSession::ChatSession(void)" (??0ChatSession@Demo@IceProxy@@QAE@XZ)
Client.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall IceProxy::Glacier2::Session::Session(void)" (__imp_??0Session@Glacier2@IceProxy@@QAE@XZ)


What are the causes of these errors?
I have followed the instructions presented in this post:
http://www.zeroc.com/vbulletin/showthread.php?t=240


Thank you in advance


With my very best regards



Alberto

Comments

  • bernard
    bernard Jupiter, FL
    Hi Alberto,

    This looks like a project properties problem; you should double-check in particular Configuration Properties/C/C++/Code Generation/Runtime Library. It should be Multi-threaded Debug (if you link with Iced.lib) or Multi-threaded Release (if you link with Ice.lib).

    If you can't figure it out, please attach your project file (.vcproj).

    For the unresolved Glacier2 symbols, you need to link with Glacier2, i.e. add glacier2.lib to your list of libraries.

    Cheers,
    Bernard
  • Hi Bernard,
    thank you very much for your quick reply to my post.

    Unfortunately the MultiThreaded Debug is properly set, using the Iced.lib IceUtild.lib libraries, I can't figure out where is the problem.

    You will find attached the project file (compressed).

    Where sould I specify the link to the glacier2.lib?


    Thank you


    Cheers


    Alberto
  • bernard
    bernard Jupiter, FL
    Hi Alberto,

    Please try to set
    Configuration Properties/C/C++/Language/Enable Run-Time Type Info to Yes

    'Yes' should be the default, but I don't see anything else suspicious in your project file. Don't forget to rebuild your application afterwards.

    You also need to add 'glacier2d.lib' [debug] or 'glacier2.lib' [release] to
    Configuration Properties/Linker/Input/Additional dependencies.

    Cheers,
    Bernard
  • bernard
    bernard Jupiter, FL
    Could you post Client.cpp?

    Thanks,
    Bernard
  • Dear Bernard,
    sorry for the inconvenience!

    I've resolved everything! It was just a mispelling...

    Thanks a lot for your help!

    Do I have to include only the needed libraries for the project? For example: this one needs: Iced.lib IceUtild.lib glacier2d.lib
    In the case I would include all of them for a "simple" project like this, will I experience a big loss of performance?
    I'm asking this just not to remember to take care also of the properties of the project when I will write some more complicate source codes.



    Thanks again


    Sincerely


    Alberto


    With my very best regards
  • bernard
    bernard Jupiter, FL
    Hi Alberto,

    Glad to hear you figured it out!

    You can list as many libraries as you like: Visual C++ will only use the ones it needs: there is no downside. However this is not true on all platforms; for example on Linux and Solaris, you'd better link with only the libraries you need.

    Cheers,
    Bernard