Archived
This forum has been archived. Please start a new discussion on GitHub.
linker error while compiling a demo ICE program
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)" (??1Shared@IceUtil@@$$FUAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000101) "public: virtual __thiscall IceInternal::GCShared::~GCShared(void)" (??1GCShared@IceInternal@@$$FUAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) 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 " (?__gcReachable@Object@Ice@@$$FUBEXAAV?$map@PAVGCShared@IceInternal@@std@@V?$allocator@U?$pair@QAVGCShared@IceInternal@@4@@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 " (?__gcReachable@Object@Ice@@$$F$R4BI@M@PPPPPPPM@BM@BEXAAV?$map@PAVGCShared@IceInternal@@std@@V?$allocator@U?$pair@QAVGCShared@IceInternal@@4@@Z) ICE_Sample.obj
error LNK2028: unresolved token (0A00010F) "public: virtual void __thiscall Ice::Object::__gcClear(void)" (?__gcClear@Object@Ice@@$$FUAEXXZ) referenced in function "[thunk]:public: virtual void __thiscall Ice::Object::__gcClear`vtordispex{24,12,4294967292,28}' (void)" (?__gcClear@Object@Ice@@$$F$R4BI@M@PPPPPPPM@BM@AEXXZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000110) "protected: __thiscall Ice::Object::Object(void)" (??0Object@Ice@@$$FIAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000111) "protected: virtual __thiscall Ice::Object::~Object(void)" (??1Object@Ice@@$$FMAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000112) "public: __thiscall IceInternal::GCShared::GCShared(void)" (??0GCShared@IceInternal@@$$FQAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000146) "public: __thiscall Ice::AdapterNotFoundException::AdapterNotFoundException(void)" (??0AdapterNotFoundException@Ice@@$$FQAE@XZ) referenced in function "void __clrcall `anonymous namespace'::`dynamic initializer for 'void __clrcall Ice::__AdapterNotFoundException_init::A0xbd67f472(void)''(void)" (???__E?A0xbd67f472@__AdapterNotFoundException_init@Ice@@YMXXZ@?A0xbd67f472@@$$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
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)" (??1Shared@IceUtil@@$$FUAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000101) "public: virtual __thiscall IceInternal::GCShared::~GCShared(void)" (??1GCShared@IceInternal@@$$FUAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) 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 " (?__gcReachable@Object@Ice@@$$FUBEXAAV?$map@PAVGCShared@IceInternal@@std@@V?$allocator@U?$pair@QAVGCShared@IceInternal@@4@@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 " (?__gcReachable@Object@Ice@@$$F$R4BI@M@PPPPPPPM@BM@BEXAAV?$map@PAVGCShared@IceInternal@@std@@V?$allocator@U?$pair@QAVGCShared@IceInternal@@4@@Z) ICE_Sample.obj
error LNK2028: unresolved token (0A00010F) "public: virtual void __thiscall Ice::Object::__gcClear(void)" (?__gcClear@Object@Ice@@$$FUAEXXZ) referenced in function "[thunk]:public: virtual void __thiscall Ice::Object::__gcClear`vtordispex{24,12,4294967292,28}' (void)" (?__gcClear@Object@Ice@@$$F$R4BI@M@PPPPPPPM@BM@AEXXZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000110) "protected: __thiscall Ice::Object::Object(void)" (??0Object@Ice@@$$FIAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000111) "protected: virtual __thiscall Ice::Object::~Object(void)" (??1Object@Ice@@$$FMAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000112) "public: __thiscall IceInternal::GCShared::GCShared(void)" (??0GCShared@IceInternal@@$$FQAE@XZ) referenced in function "public: __thiscall Demo::Printer::Printer(void)" (??0Printer@Demo@@$$FQAE@XZ) ICE_Sample.obj
error LNK2028: unresolved token (0A000146) "public: __thiscall Ice::AdapterNotFoundException::AdapterNotFoundException(void)" (??0AdapterNotFoundException@Ice@@$$FQAE@XZ) referenced in function "void __clrcall `anonymous namespace'::`dynamic initializer for 'void __clrcall Ice::__AdapterNotFoundException_init::A0xbd67f472(void)''(void)" (???__E?A0xbd67f472@__AdapterNotFoundException_init@Ice@@YMXXZ@?A0xbd67f472@@$$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
0
Comments
-
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.0
-
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.0