i encounter the same problem, that it said "Only multi-threaded DLL libraries can be used with Ice!"
so... does it mean that i have to setup my project as a DLL?
i want to test the program given in the manual, here is my source:
Code:
//===========================================
// Server.cpp : Definition of a console program's entry point
//
#include "stdafx.h"
#include <Ice/Ice.h>
#include <Printer.h>
using namespace std;
using namespace PrintSys;
class PrinterI : public Printer {
public:
virtual void printString(const string & s,
const Ice::Current &);
};
void
PrinterI::
printString(const 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,
Ice::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;
}
//============================================
// Client.cpp : Definition of a console program's entry point
//
#include "stdafx.h"
#include <Ice/Ice.h>
#include <Printer.h>
using namespace std;
using namespace PrintSys;
int
main(int argc, char * argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectPrx base = ic->stringToProxy(
"SimplePrinter:default -p 10000");
PrinterPrx printer = PrinterPrx::checkedCast(base);
if (!printer)
throw "Invalid proxy";
printer->printString("Hello World!");
} catch (const Ice::Exception & ex) {
cerr << ex << endl;
status = 1;
} catch (const char * msg) {
cerr << msg << endl;
status = 1;
}
if (ic)
ic->destroy();
return status;
}
//======================
i set the project as "/MD"(multi-thread DLL), though my project was initaially a console program. despite of a few warnings, i get through the compile process, and then it wouldn't link.
the messages was:
Code:
Linking ...
Server.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl IceUtil::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class IceUtil::Exception const &)" (__imp_??6IceUtil@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABVException@0@@Z) ,it was referenced by function: __catch$_main$0
... many similar lines...