Archived
This forum has been archived. Please start a new discussion on GitHub.
Failed to compile generated class files from slice
Hello,
I attempted to run the HelloWorld sample (from the documentation) for C++.
First I wrote the slice file; Then used slice2cpp.
Using eclipse (with Cygwin), I configured the project to include the files from "C:\Program Files\ZeroC\Ice-3.4.2\include"; Then I tried to compile the Printer class alone.
At first it failed because the "Printer.cpp" file has this:
Then, trying to compile again, I get a lot of error messages. I can't post the whole log here due to the 10k characters limit so these are just the first lines:
What is missing?
- Rafael
I attempted to run the HelloWorld sample (from the documentation) for C++.
First I wrote the slice file; Then used slice2cpp.
Using eclipse (with Cygwin), I configured the project to include the files from "C:\Program Files\ZeroC\Ice-3.4.2\include"; Then I tried to compile the Printer class alone.
At first it failed because the "Printer.cpp" file has this:
#include <Printer.h>I had to change to this:
#include "Printer.h"
Then, trying to compile again, I get a lot of error messages. I can't post the whole log here due to the 10k characters limit so these are just the first lines:
Building target: Test Project 1.1 - C++ Hello.exe
Invoking: Cygwin C++ Linker
g++ -L"C:\Program Files\ZeroC\Ice-3.4.2\lib\bcc10" -o"Test Project 1.1 - C++ Hello.exe" ./Printer.o
./Printer.o: In function `_ZN4Demo19__patch__PrinterPtrEPvRN11IceInternal6HandleIN3Ice6ObjectEEE':
/cygdrive/c/Users/Rafael/workspace/Test Project 1.1 - C++ Hello/Debug/../Printer.cpp:390: undefined reference to `IceInternal::Ex::throwUOE(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
./Printer.o: In function `_ZN4Demo7Printer6__readERKN11IceInternal6HandleIN3Ice11InputStreamEEEb':
/cygdrive/c/Users/Rafael/workspace/Test Project 1.1 - C++ Hello/Debug/../Printer.cpp:376: undefined reference to `Ice::MarshalException::MarshalException(char const*, int)'
/cygdrive/c/Users/Rafael/workspace/Test Project 1.1 - C++ Hello/Debug/../Printer.cpp:378: undefined reference to `Ice::MarshalException::~MarshalException()'
/cygdrive/c/Users/Rafael/workspace/Test Project 1.1 - C++ Hello/Debug/../Printer.cpp:378: undefined reference to `typeinfo for Ice::MarshalException'
/cygdrive/c/Users/Rafael/workspace/Test Project 1.1 - C++ Hello/Debug/../Printer.cpp:378: undefined reference to `Ice::MarshalException::~MarshalException()'
What is missing?
- Rafael
0
Comments
-
Hi Rafael,
Ice 3.4.2 does not support GCC on Windows. You should use one of the supported compilers. Here you were trying to link your GCC objects with BCC (== Codegear C++Builder) libraries.
Best regards,
Bernard0 -
Hello again,
I got MS Visual Studio 2008 Express. When I try to compile the HelloWorld sample, I get errors like this:1>Printer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall IceProxy::Ice::Object::__copyFrom(class IceInternal::ProxyHandle<class IceProxy::Ice::Object> const &)" (__imp_?__copyFrom@Object@Ice@IceProxy@@QAEXABV?$ProxyHandle@VObject@Ice@IceProxy@@@IceInternal@@@Z) referenced in function "void __cdecl Demo::__read(class IceInternal::BasicStream *,class IceInternal::ProxyHandle<class IceProxy::Demo::Printer> &)" (?__read@Demo@@YAXPAVBasicStream@IceInternal@@AAV?$ProxyHandle@VPrinter@Demo@IceProxy@@@3@@Z) 1>Printer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall IceInternal::BasicStream::read(class IceInternal::ProxyHandle<class IceProxy::Ice::Object> &)" (__imp_?read@BasicStream@IceInternal@@QAEXAAV?$ProxyHandle@VObject@Ice@IceProxy@@@2@@Z) referenced in function "void __cdecl Demo::__read(class IceInternal::BasicStream *,class IceInternal::ProxyHandle<class IceProxy::Demo::Printer> &)" (?__read@Demo@@YAXPAVBasicStream@IceInternal@@AAV?$ProxyHandle@VPrinter@Demo@IceProxy@@@3@@Z) 1>Printer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall IceProxy::Ice::Object::Object(void)" (__imp_??0Object@Ice@IceProxy@@QAE@XZ) referenced in function "public: __thiscall IceProxy::Demo::Printer::Printer(void)" (??0Printer@Demo@IceProxy@@QAE@XZ) 1>Printer.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IceUtil::Shared::__incRef(void)" (?__incRef@Shared@IceUtil@@UAEXXZ) 1>Server.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IceUtil::Shared::__incRef(void)" (?__incRef@Shared@IceUtil@@UAEXXZ) 1>Printer.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IceUtil::Shared::__decRef(void)" (?__decRef@Shared@IceUtil@@UAEXXZ) 1>Server.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IceUtil::Shared::__decRef(void)" (?__decRef@Shared@IceUtil@@UAEXXZ) 1>Printer.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall IceUtil::Shared::__getRef(void)const " (?__getRef@Shared@IceUtil@@UBEHXZ)
Is Cygwin disturbing somehow?
- Rafael0 -
Hello Rafael,
As a first step, you should build the demos, for example book\printer:
- install Ice 3.4.2 on Windows, using the Ice-3.4.2.msi
- setup your environment / VS2008 Express as per the instructions in the release notes
- read the demos README.txt for instructions on how to build the demos with VS2008 Express
The installer creates a program group with a shortcut to the demos, installed in ...Documents\ZeroC\Ice-3.4.2-demos.
Best regards,
Bernard0 -
The demos have a makefile. I was trying to compile and run my project inside the Microsoft Visual Studio.
And I just did it.
I included the "include" and "lib" directories, and set as well the dependencies for "iced.lib" and "iceutild.lib", but it wasn't enough. The only thing missing was to include a "." in the directories list. It's compiling and running now. Such a simple thing which took me so long to figure out.
- Rafael0