Go Back   ZeroC Forums > Bug Reports

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 09-22-2004
chenhong_sz chenhong_sz is offline
Registered User
 
 
Join Date: Nov 2003
Location: China.Shenzhen
Posts: 35
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?
Reply With Quote
  #2 (permalink)  
Old 09-22-2004
bernard's Avatar
bernard bernard is offline
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 761
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
Reply With Quote
  #3 (permalink)  
Old 09-23-2004
chenhong_sz chenhong_sz is offline
Registered User
 
 
Join Date: Nov 2003
Location: China.Shenzhen
Posts: 35
thank you your recommend.
but now has a new question:
Sample Application run time error
can you give me some advice?
Reply With Quote
  #4 (permalink)  
Old 04-20-2005
yrh79 yrh79 is offline
Registered User
 
 
Join Date: Apr 2005
Posts: 7
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;
}
//======================
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...

Last edited by yrh79 : 04-20-2005 at 02:34 AM.
Reply With Quote
  #5 (permalink)  
Old 04-20-2005
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,475
No this doesn't mean that you need to build your project as a multi-threaded DLL. You just need to ensure that you're compiling your console application with the right runtime library: either the debug (build with /MDd) or release (build with /MD) multi-threaded C runtime library. And you also need to link with the correct Ice library: ice.lib (for release) and iced.lib (for debug). It looks like from the error message that you're not linking you application with the Ice library.

Please take a look at the Visual C++ Ice demo projects for examples on how to setup a project.

Benoit.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -4. The time now is 07:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.