|
|
|
|||||
|
Only multi-threaded DLL libraries can be used with Ice!
when i complie a project ,a error message shown:
"Only multi-threaded DLL libraries can be used with Ice!' i found it defined as follow: # if !defined(_DLL) || !defined(_MT) # error "Only multi-threaded DLL libraries can be used with Ice!" # endif so i add _DLL,_MT in project->setting->c/c++->preprocessor definitions and rebuild, it look ok,but i don't know what its meaning. if when the program use multi-thread, and user must set the _DLL and _MT? |
|
||||||
|
This just means the Ice libraries are built with /MD (release) or /MDd (debug) and you should do the same (using the appropriate drop-down list or checkbox, not by adding definitions).
I also recommend you have a look at the Microsoft documentation, such as http://msdn.microsoft.com/library/de..._libraries.asp. Cheers, Bernard |
|
|||||
|
thank you your recommend.
but now has a new question: Sample Application run time error can you give me some advice? |
|
|||||
|
do i have to setup my project as a DLL? i can't link the program.
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;
}
//======================
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 Last edited by yrh79 : 04-20-2005 at 02:34 AM. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Code convention for .Net Ice libraries | vermorel | Comments | 2 | 12-08-2005 12:58 AM |
| Ice and single threaded libraries | Nis Baggesen | Help Center | 4 | 03-22-2005 04:25 AM |
| How can I run my ice server program in multi-threaded mode | level | Bug Reports | 4 | 03-31-2004 08:45 PM |
| How can I run my ice server program in multi-threaded mode | level | Help Center | 3 | 03-31-2004 07:13 PM |
| ICE calling a Single Threaded DLL | amrufon | Help Center | 7 | 08-04-2003 09:49 PM |