Archived
This forum has been archived. Please start a new discussion on GitHub.
HelloWorld: Problems with C++
in Help Center
Hi,
I'm stuying ICE reading the 1500+ pages Guide and now using the Helloword example.
In my first HelloWorld test I have succesfully connected a Java server and a Java client between Eclipse/Windows and Eclipse/Ubuntu machines.
Now I'm trying to do same thing using C++.
I use the slice2cpp tool, and it creates Printer.cpp and Printer.h
Now from MS Visual Studio 2006 I try to compile and link the Printer.cpp file (second parapraph page 37 Guide) but I get the following error:
Obviously the Printer.h file is in the same folder.
If I change the <Printer.h> for "Printer.h" it works but I get the following error (in Windows)
Can anyone help me?
Thanks
I'm stuying ICE reading the 1500+ pages Guide and now using the Helloword example.
In my first HelloWorld test I have succesfully connected a Java server and a Java client between Eclipse/Windows and Eclipse/Ubuntu machines.
Now I'm trying to do same thing using C++.
I use the slice2cpp tool, and it creates Printer.cpp and Printer.h
Now from MS Visual Studio 2006 I try to compile and link the Printer.cpp file (second parapraph page 37 Guide) but I get the following error:
Compiling... Printer.cpp .\Printer.cpp(13) : fatal error C1083: Cannot open include file: 'Printer.h': No such file or directory Build log was saved at "file://d:\...\workspace Visual\ICE\Debug\BuildLog.htm" ICE - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========If I do the same in Ubuntu from shell I get the same error.
Obviously the Printer.h file is in the same folder.
If I change the <Printer.h> for "Printer.h" it works but I get the following error (in Windows)
Compiling... Printer.cpp C:\Ice-3.2.0\include\IceUtil/Config.h(112) : fatal error C1189: #error : "Only multi-threaded DLL libraries can be used with Ice!"
Can anyone help me?
Thanks
0
Comments
-
These are just project setup problems. The first issue is a simple include search path problem. You need to add "/I." to your list of additional include directories.
The second is likely that you haven't specified the correct runtime libraries in your project. It should be Multi-threaded Debug DLL /MDd for debug projects and Multi-threaded DLL (/MD) for release configuration projects.
Cheers,
Brent0 -
Thanks beagles.
Now it works0 -
Hi Guys,
I am working through the HelloWorld section in the Ice-3.4.0 document I managed to run the Java Client and Server without any trouble. With regards to the C++ I have managed to compile the Printer, Server and Client but I cannot seem to link them. I am not experienced with C++ at all, and I think I might be fighting with a windows syntax problem. What the doc says is the following:$ c++ -o client Printer.o Client.o -L$ICE_HOME/lib -lIce -lIceUtil
Since I am in windows I run the following:$ c++ -o client Printer.o Client.o -L%ICE_HOME%/lib -lIce -lIceUtil
It does not seem to see the lib files. I have taken a look in the lib folder and see that the files are named in lower case. I have tried to run the command with lowercase file names, and still recieve the same errors.
Here is the first few errors I recieve, but there is about 600+ lines getting printed out. All the Undefined reference errors lead me to believe the lib files are not being added.
Please can some one help me ? I am not exeprienced in C++ and have mainly done Java development so I am not sure if I am missing a command required to compile this in windows. I am using MinGW as my compiler.C:\>c++ -o server Printer.o Server.o -L%ICE_HOME%\lib -lIce -lIc eUtil Printer.o:Printer.cpp:(.text+0x1ba): undefined reference to `IceInternal::BasicStream::read(IceInternal::ProxyHandle<IceProxy::Ice::Object>&)' Printer.o:Printer.cpp:(.text+0x271): undefined reference to `IceProxy::Ice::Object::__copyFrom(IceInternal::ProxyHandle<IceProxy::Ice::Object> const&) ' Printer.o:Printer.cpp:(.text+0x34c): undefined reference to `IceProxy::Ice::Object::__getDelegate(bool)' Printer.o:Printer.cpp:(.text+0x4ab): undefined reference to `IceProxy::Ice::Object::__handleExceptionWrapper(IceInternal::Handle<IceDelegate::Ice::Obj ect> const&, IceInternal::LocalExceptionWrapper const&)' Printer.o:Printer.cpp:(.text+0x531): undefined reference to `IceProxy::Ice::Object::__handleException(IceInternal::Handle<IceDelegate::Ice::Object> co nst&, Ice::LocalException const&, bool, int&)' Printer.o:Printer.cpp:(.text+0x6b6): undefined reference to `IceInternal::OutgoingAsync::OutgoingAsync(IceInternal::ProxyHandle<IceProxy::Ice::Object> const&, std::string const&, IceUtil::Handle<IceInternal::CallbackBase> const&, IceInternal::Handle<Ice::LocalObject> const&)' Printer.o:Printer.cpp:(.text+0x767): undefined reference to `IceInternal::OutgoingAsync::__prepare(std::string const&, Ice::OperationMode, std::map<st d::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const*)' Printer.o:Printer.cpp:(.text+0x7c0): undefined reference to `IceInternal::OutgoingAsync::__send(bool)' Printer.o:Printer.cpp:(.text+0x805): undefined reference to `Ice::AsyncResult::__exceptionAsync(IceUtil::Exception const&)' Printer.o:Printer.cpp:(.text+0x914): undefined reference to `IceProxy::Ice::Object::__end(IceInternal::Handle<Ice::AsyncResult> const&, std::string co nst&) const' Printer.o:Printer.cpp:(.text+0xc57): undefined reference to `IceInternal::Outgoing::Outgoing(IceInternal::RequestHandler*, std::string const&, Ice::Op erationMode, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const*)' Printer.o:Printer.cpp:(.text+0xcd8): undefined reference to `IceInternal::Outgoing::abort(Ice::LocalException const&)' Printer.o:Printer.cpp:(.text+0xd19): undefined reference to `IceInternal::Outgoing::invoke()' Printer.o:Printer.cpp:(.text+0xd65): undefined reference to `IceInternal::Outgoing::throwUserException()' Printer.o:Printer.cpp:(.text+0xded): undefined reference to `Ice::UnknownUserException::UnknownUserException(char const*, int, std::string const&)' Printer.o:Printer.cpp:(.text+0xe90): undefined reference to `Ice::UnknownUserException::~UnknownUserException()' Printer.o:Printer.cpp:(.text+0xed6): undefined reference to `Ice::UnknownUserException::~UnknownUserException()' Printer.o:Printer.cpp:(.text+0xfa8): undefined reference to `IceInternal::LocalExceptionWrapper::LocalExceptionWrapper(Ice::LocalException const&, boo l)'
0 -
Hi Hemant,
Welcome to our forums!
C++ compilers are typically not compatible with each other, and therefore you want to use Ice with a supported C++ compiler. With Ice 3.4.0 on Windows, this would be either Visual Studio 2008 (with SP1) or CodeGear C++Builder 2010.
The simplest is probably to download Visual Studio 2008 Express:
Microsoft Express Downloads
Download details: Visual Studio 2008 Express Editions with SP1
(Visual Studio 2010 was just released - but you want download the 2008 version!)
Then, try to C++ demos to see how to build C++ programs using Ice.
Best regards,
Bernard0 -
Hi Bernard,
Thanks. Will look into Visual Studio and see if I can get this running.0 -
Hi Guys,
I am working through the HelloWorld section in the Ice-3.4.0 document I managed to run the Java Client and Server without any trouble. With regards to the C++ I have managed to compile the Printer, Server and Client but I cannot seem to link them. I am not experienced with C++ at all, and I think I might be fighting with a windows syntax problem. What the doc says is the following:$ c++ -o client Printer.o Client.o -L$ICE_HOME/lib -lIce -lIceUtil
Since I am in windows I run the following:$ c++ -o client Printer.o Client.o -L%ICE_HOME%/lib -lIce -lIceUtil
It does not seem to see the lib files. I have taken a look in the lib folder and see that the files are named in lower case. I have tried to run the command with lowercase file names, and still recieve the same errors.
Here is the first few errors I recieve, but there is about 600+ lines getting printed out. All the Undefined reference errors lead me to believe the lib files are not being added.
Please can some one help me ? I am not exeprienced in C++ and have mainly done Java development so I am not sure if I am missing a command required to compile this in windows. I am using MinGW as my compiler.C:\>c++ -o server Printer.o Server.o -L%ICE_HOME%\lib -lIce -lIc eUtil Printer.o:Printer.cpp:(.text+0x1ba): undefined reference to `IceInternal::BasicStream::read(IceInternal::ProxyHandle<IceProxy::Ice::Object>&)' Printer.o:Printer.cpp:(.text+0x271): undefined reference to `IceProxy::Ice::Object::__copyFrom(IceInternal::ProxyHandle<IceProxy::Ice::Object> const&) ' Printer.o:Printer.cpp:(.text+0x34c): undefined reference to `IceProxy::Ice::Object::__getDelegate(bool)' Printer.o:Printer.cpp:(.text+0x4ab): undefined reference to `IceProxy::Ice::Object::__handleExceptionWrapper(IceInternal::Handle<IceDelegate::Ice::Obj ect> const&, IceInternal::LocalExceptionWrapper const&)' Printer.o:Printer.cpp:(.text+0x531): undefined reference to `IceProxy::Ice::Object::__handleException(IceInternal::Handle<IceDelegate::Ice::Object> co nst&, Ice::LocalException const&, bool, int&)' Printer.o:Printer.cpp:(.text+0x6b6): undefined reference to `IceInternal::OutgoingAsync::OutgoingAsync(IceInternal::ProxyHandle<IceProxy::Ice::Object> const&, std::string const&, IceUtil::Handle<IceInternal::CallbackBase> const&, IceInternal::Handle<Ice::LocalObject> const&)' Printer.o:Printer.cpp:(.text+0x767): undefined reference to `IceInternal::OutgoingAsync::__prepare(std::string const&, Ice::OperationMode, std::map<st d::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const*)' Printer.o:Printer.cpp:(.text+0x7c0): undefined reference to `IceInternal::OutgoingAsync::__send(bool)' Printer.o:Printer.cpp:(.text+0x805): undefined reference to `Ice::AsyncResult::__exceptionAsync(IceUtil::Exception const&)' Printer.o:Printer.cpp:(.text+0x914): undefined reference to `IceProxy::Ice::Object::__end(IceInternal::Handle<Ice::AsyncResult> const&, std::string co nst&) const' Printer.o:Printer.cpp:(.text+0xc57): undefined reference to `IceInternal::Outgoing::Outgoing(IceInternal::RequestHandler*, std::string const&, Ice::Op erationMode, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const*)' Printer.o:Printer.cpp:(.text+0xcd8): undefined reference to `IceInternal::Outgoing::abort(Ice::LocalException const&)' Printer.o:Printer.cpp:(.text+0xd19): undefined reference to `IceInternal::Outgoing::invoke()' Printer.o:Printer.cpp:(.text+0xd65): undefined reference to `IceInternal::Outgoing::throwUserException()' Printer.o:Printer.cpp:(.text+0xded): undefined reference to `Ice::UnknownUserException::UnknownUserException(char const*, int, std::string const&)' Printer.o:Printer.cpp:(.text+0xe90): undefined reference to `Ice::UnknownUserException::~UnknownUserException()' Printer.o:Printer.cpp:(.text+0xed6): undefined reference to `Ice::UnknownUserException::~UnknownUserException()' Printer.o:Printer.cpp:(.text+0xfa8): undefined reference to `IceInternal::LocalExceptionWrapper::LocalExceptionWrapper(Ice::LocalException const&, boo l)'
I'm compiling with CodeGear C++Builder 2010 and have the same problem. What can I do?0