Home Help Center

linker error while compiling a demo ICE program

srujankumarsrujankumar Member Srujan ChennupatiOrganization: Cat AcadamyProject: Monitors services running on target machines
Hi,

I'm a lecturer in a training institute. I was trying to build a sample code given in one of the documents that I've downloaded from ZeroC site on a Visual Studio 2005 SP1. Following are the linker errors that I'm facing. In one of the previous posts on the forums you've mentioned to change the \clr to none. I've followed the changes suggested yet I'm facing the same errors. Its a very basic application.

Following is the code that I've written. Pls correct me if I'm wrong some where.

Printer.ice

module Demo {
interface Printer {
void printString(string s);
};
};


ICE_Sample.cpp

// ICE_Sample.cpp : Defines the entry point for the console application.
//

#include <Ice\Ice.h>
#include "stdafx.h"
#include "Printer.h"

using namespace std;
using namespace Demo;

class PrinterI : public Printer
{
public:
virtual void printString(const string& s, const Ice::Current&);
};

void
PrinterI::
printString(const std::string &s, const Ice::Current &)
{
cout<<s<<endl;
}


int main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;

try{
ic = Ice::initialize(argc, argv);
Ice::ObjectAdapterPtr adapter
= ic->createObjectAdapterWithEndpoints(
"SimplePrinterAdapter", "default -p 10000");
Ice::ObjectPtr object = new PrinterI;
adapter->add(object, ic->stringToIdentity("SimplePrinter"));
adapter->activate();
ic->waitForShutdown();
}
catch(const Ice::Exception& e)
{
cerr << e << endl;
status = 1;
}
catch(const char* msg)
{
cerr << msg << endl;
status = 1;
}

if(ic)
{
try{
ic->destroy();
}
catch(const Ice::Exception& e)
{
cerr << e << endl;
status = 1;
}
}

return status;
}

Following are the errors that I'm facing:

error LNK2028: unresolved token (0A0000FF) "public: virtual __thiscall IceUtil::Shared::~Shared(void)" ([email protected]@@[email protected]) referenced in function "public: __thiscall Demo::Printer::Printer(void)" ([email protected]@@[email protected]) ICE_Sample.obj
error LNK2028: unresolved token (0A000101) "public: virtual __thiscall IceInternal::GCShared::~GCShared(void)" ([email protected]@@[email protected]) referenced in function "public: __thiscall Demo::Printer::Printer(void)" ([email protected]@@[email protected]) ICE_Sample.obj
error LNK2028: unresolved token (0A00010E) "public: virtual void __thiscall Ice::Object::__gcReachable(class std::map<class IceInternal::GCShared *,int,struct std::less<class IceInternal::GCShared *>,class std::allocator<struct std::pair<class IceInternal::GCShared * const,int> > > &)const " ([email protected]@[email protected]@$$FUBEXAAV[email protected]@[email protected]@[email protected]@V[email protected][email protected]@[email protected]@[email protected]@Z) referenced in function "[thunk]:public: virtual void __thiscall Ice::Object::__gcReachable`vtordispex{24,12,4294967292,28}' (class std::map<class IceInternal::GCShared *,int,struct std::less<class IceInternal::GCShared *>,class std::allocator<struct std::pair<class IceInternal::GCShared * const,int> > > &)const " ([email protected]@[email protected]@[email protected]@[email protected]@BEXAAV[email protected]@[email protected]@[email protected]@V[email protected][email protected]@[email protected]@[email protected]@Z) ICE_Sample.obj
error LNK2028: unresolved token (0A00010F) "public: virtual void __thiscall Ice::Object::__gcClear(void)" ([email protected]@[email protected]@$$FUAEXXZ) referenced in function "[thunk]:public: virtual void __thiscall Ice::Object::__gcClear`vtordispex{24,12,4294967292,28}' (void)" ([email protected]@[email protected]@[email protected]@[email protected]@AEXXZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000110) "protected: __thiscall Ice::Object::Object(void)" ([email protected]@@[email protected]) referenced in function "public: __thiscall Demo::Printer::Printer(void)" ([email protected]@@[email protected]) ICE_Sample.obj
error LNK2028: unresolved token (0A000111) "protected: virtual __thiscall Ice::Object::~Object(void)" ([email protected]@@[email protected]) referenced in function "public: __thiscall Demo::Printer::Printer(void)" ([email protected]@@[email protected]) ICE_Sample.obj
error LNK2028: unresolved token (0A000112) "public: __thiscall IceInternal::GCShared::GCShared(void)" ([email protected]@@[email protected]) referenced in function "public: __thiscall Demo::Printer::Printer(void)" ([email protected]@@[email protected]) ICE_Sample.obj
error LNK2028: unresolved token (0A000146) "public: __thiscall Ice::AdapterNotFoundException::AdapterNotFoundException(void)" ([email protected]@@[email protected]) referenced in function "void __clrcall `anonymous namespace'::`dynamic initializer for 'void __clrcall Ice::__AdapterNotFoundException_init::A0xbd67f472(void)''(void)" ([email protected][email protected]@@[email protected][email protected]@$$FYMXXZ) ICE_Sample.obj
.
.
.
.
.
fatal error LNK1120: 73 unresolved externals C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\ICE_Sample\Debug\ICE_Sample.exe


I would appreciate your help in resolving this issue.


Regards,
Srujan Chennupati

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    It looks to me you are not linking Ice.lib and IceUtil.lib. Did you look at the setup of the demos that accompany the Ice distribution? That should help you get started with your own project settings.
  • srujankumarsrujankumar Member Srujan ChennupatiOrganization: Cat AcadamyProject: Monitors services running on target machines
    Matthew, your suggestion has worked. I've missed placing the Ice.lib and IceUtil.lib in the project settings. It works fine now.

    I've another question. Can I use the Ice to transfer a few files from windows to Linux client.
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    Yes, Ice can be used to transfer files between Windows and Linux machines (or between any of the platforms/languages that Ice supports). For more info on file transfer you should take a look at this faq and Matthew's article in issue 20 of the newsletter.
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    You might also want to check out IcePatch2, which makes it very easy to keep clients in sync with a master copy of a set of files.

    Cheers,

    Michi.
Sign In or Register to comment.