Home Help Center

Failed to compile generated class files from slice

barbarescobarbaresco Member Rafael BarbarescoOrganization: Federal University of Santa CatarinaProject: Mobile Agents for a Search Engine
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:
#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

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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,
    Bernard
  • barbarescobarbaresco Member Rafael BarbarescoOrganization: Federal University of Santa CatarinaProject: Mobile Agents for a Search Engine
    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 &)" ([email protected]@[email protected]@@[email protected]@[email protected]@@@[email protected]@@Z) referenced in function "void __cdecl Demo::__read(class IceInternal::BasicStream *,class IceInternal::ProxyHandle<class IceProxy::Demo::Printer> &)" ([email protected]@@[email protected]@@[email protected]@[email protected]@@@[email protected]@Z)
    1>Printer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall IceInternal::BasicStream::read(class IceInternal::ProxyHandle<class IceProxy::Ice::Object> &)" ([email protected]@[email protected]@[email protected]@[email protected]@@@[email protected]@Z) referenced in function "void __cdecl Demo::__read(class IceInternal::BasicStream *,class IceInternal::ProxyHandle<class IceProxy::Demo::Printer> &)" ([email protected]@@[email protected]@@[email protected]@[email protected]@@@[email protected]@Z)
    1>Printer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall IceProxy::Ice::Object::Object(void)" ([email protected]@[email protected]@[email protected]) referenced in function "public: __thiscall IceProxy::Demo::Printer::Printer(void)" ([email protected]@[email protected]@[email protected])
    1>Printer.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IceUtil::Shared::__incRef(void)" ([email protected]@[email protected]@UAEXXZ)
    1>Server.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IceUtil::Shared::__incRef(void)" ([email protected]@[email protected]@UAEXXZ)
    1>Printer.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IceUtil::Shared::__decRef(void)" ([email protected]@[email protected]@UAEXXZ)
    1>Server.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IceUtil::Shared::__decRef(void)" ([email protected]@[email protected]@UAEXXZ)
    1>Printer.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall IceUtil::Shared::__getRef(void)const " ([email protected]@[email protected]@UBEHXZ)
    

    Is Cygwin disturbing somehow?

    - Rafael
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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,
    Bernard
  • barbarescobarbaresco Member Rafael BarbarescoOrganization: Federal University of Santa CatarinaProject: Mobile Agents for a Search Engine
    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.

    - Rafael
Sign In or Register to comment.