Archived

This forum has been archived. Please start a new discussion on GitHub.

Problem with Hello World?

I can't get slice2cpp to run on Printer.ice, nor can I get it to correctly compile when I use already generated versions of Printer.h & Printer.cpp. The former complains of missing libSlice.so.31, and the latter gives a spray of 'undefined' errors for ice components. I suspect the installation may not have worked properly, but I don't know how to fix it. What should I do? (What info do I need to provide?)

OS: Centos 4.4 (supposedly exactly compatible with RedHat 4.4)

Comments

  • marc
    marc Florida
    What are the error messages exactly? For the first problem, it appears that libSlice.so.31 cannot be found in your LD_LIBRARY_PATH. For the other problem, I need the exact error message to provide further assistance, as well as the exact command you use to compile and link the application.
  • For the first problem, how would I check/correct that?

    For the second:

    Okay, I type in the command:
    c++  ice_server.cpp -I/Ice-3.1.0/include -I./
    

    And I get:
    /tmp/ccoCrAz0.o(.text+0x1f2): In function `main':
    : undefined reference to `Ice::initialize(int&, char**, Ice::InitializationData const&, int)'
    /tmp/ccoCrAz0.o(.text+0x7bb): In function `main':
    : undefined reference to `IceUtil::operator<<(std::basic_ostream<char, std::char_traits<char> >&, IceUtil::Exception const&)'
    /tmp/ccoCrAz0.o(.text+0x8dc): In function `main':
    : undefined reference to `IceUtil::operator<<(std::basic_ostream<char, std::char_traits<char> >&, IceUtil::Exception const&)'
    /tmp/ccoCrAz0.o(.text+0x9be): In function `__static_initialization_and_destruction_0(int, int)':
    : undefined reference to `IceInternal::GCRecMutexInit::GCRecMutexInit()'
    /tmp/ccoCrAz0.o(.text+0x9f4): In function `__static_initialization_and_destruction_0(int, int)':
    : undefined reference to `IceInternal::FactoryTable::FactoryTable()'
    /tmp/ccoCrAz0.o(.text+0xa71): In function `__tcf_2':
    : undefined reference to `IceInternal::FactoryTable::~FactoryTable()'
    /tmp/ccoCrAz0.o(.text+0xa89): In function `__tcf_1':
    : undefined reference to `IceInternal::GCRecMutexInit::~GCRecMutexInit()'
    /tmp/ccoCrAz0.o(.gcc_except_table+0xcc): undefined reference to `typeinfo for IceUtil::Exception'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN3Ice6ObjectD2Ev+0xb): In function `Ice::Object::~Object()':
    : undefined reference to `vtable for Ice::Object'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal8GCSharedD2Ev+0xb): In function `IceInternal::GCShared::~GCShared()':
    : undefined reference to `vtable for IceInternal::GCShared'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN3Ice6ObjectC2Ev+0xd): In function `Ice::Object::Object()':
    : undefined reference to `IceInternal::GCShared::GCShared()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN3Ice6ObjectC2Ev+0x19): In function `Ice::Object::Object()':
    : undefined reference to `vtable for Ice::Object'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal11ProxyHandleIN8IceProxy3Ice6ObjectEED1Ev+0x17): In function `IceInternal::ProxyHandle<IceProxy::Ice::Object>::~ProxyHandle()':
    : undefined reference to `IceInternal::decRef(IceProxy::Ice::Object*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice12CommunicatorEEC1EPS2_+0x2d): In function `IceInternal::Handle<Ice::Communicator>::Handle(Ice::Communicator*)':
    : undefined reference to `IceInternal::incRef(Ice::Communicator*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice12CommunicatorEED1Ev+0x17): In function `IceInternal::Handle<Ice::Communicator>::~Handle()':
    : undefined reference to `IceInternal::decRef(Ice::Communicator*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice10PropertiesEEC1EPS2_+0x2d): In function `IceInternal::Handle<Ice::Properties>::Handle(Ice::Properties*)':
    : undefined reference to `IceInternal::incRef(Ice::Properties*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice10PropertiesEED1Ev+0x17): In function `IceInternal::Handle<Ice::Properties>::~Handle()':
    : undefined reference to `IceInternal::decRef(Ice::Properties*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice6LoggerEEC1EPS2_+0x2d): In function `IceInternal::Handle<Ice::Logger>::Handle(Ice::Logger*)':
    : undefined reference to `IceInternal::incRef(Ice::Logger*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice6LoggerEED1Ev+0x17): In function `IceInternal::Handle<Ice::Logger>::~Handle()':
    : undefined reference to `IceInternal::decRef(Ice::Logger*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice5StatsEEC1EPS2_+0x2d): In function `IceInternal::Handle<Ice::Stats>::Handle(Ice::Stats*)':
    : undefined reference to `IceInternal::incRef(Ice::Stats*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice5StatsEED1Ev+0x17): In function `IceInternal::Handle<Ice::Stats>::~Handle()':
    : undefined reference to `IceInternal::decRef(Ice::Stats*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice12CommunicatorEEaSERKS3_+0x23): In function `IceInternal::Handle<Ice::Communicator>::operator=(IceInternal::Handle<Ice::Communicator> const&)':
    : undefined reference to `IceInternal::incRef(Ice::Communicator*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice12CommunicatorEEaSERKS3_+0x49): In function `IceInternal::Handle<Ice::Communicator>::operator=(IceInternal::Handle<Ice::Communicator> const&)':
    : undefined reference to `IceInternal::decRef(Ice::Communicator*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice13ObjectAdapterEED1Ev+0x17): In function `IceInternal::Handle<Ice::ObjectAdapter>::~Handle()':
    : undefined reference to `IceInternal::decRef(Ice::ObjectAdapter*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice6ObjectEEC1EPS2_+0x2d): In function `IceInternal::Handle<Ice::Object>::Handle(Ice::Object*)':
    : undefined reference to `IceInternal::incRef(Ice::Object*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN11IceInternal6HandleIN3Ice6ObjectEED1Ev+0x17): In function `IceInternal::Handle<Ice::Object>::~Handle()':
    : undefined reference to `IceInternal::decRef(Ice::Object*)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZNK7IceUtil10HandleBaseIN3Ice12CommunicatorEE24throwNullHandleExceptionEPKci+0x24): In function `IceUtil::HandleBase<Ice::Communicator>::throwNullHandleException(char const*, int) const':
    : undefined reference to `IceUtil::NullHandleException::NullHandleException(char const*, int)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZNK7IceUtil10HandleBaseIN3Ice12CommunicatorEE24throwNullHandleExceptionEPKci+0x58): In function `IceUtil::HandleBase<Ice::Communicator>::throwNullHandleException(char const*, int) const':
    : undefined reference to `typeinfo for IceUtil::NullHandleException'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN7IceUtil19NullHandleExceptionD1Ev+0xb): In function `IceUtil::NullHandleException::~NullHandleException()':
    : undefined reference to `vtable for IceUtil::NullHandleException'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN7IceUtil19NullHandleExceptionD1Ev+0x16): In function `IceUtil::NullHandleException::~NullHandleException()':
    : undefined reference to `IceUtil::Exception::~Exception()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZNK7IceUtil10HandleBaseIN3Ice13ObjectAdapterEE24throwNullHandleExceptionEPKci+0x24): In function `IceUtil::HandleBase<Ice::ObjectAdapter>::throwNullHandleException(char const*, int) const':
    : undefined reference to `IceUtil::NullHandleException::NullHandleException(char const*, int)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZNK7IceUtil10HandleBaseIN3Ice13ObjectAdapterEE24throwNullHandleExceptionEPKci+0x58): In function `IceUtil::HandleBase<Ice::ObjectAdapter>::throwNullHandleException(char const*, int) const':
    : undefined reference to `typeinfo for IceUtil::NullHandleException'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xc): undefined reference to `Demo::Printer::ice_clone() const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x10): undefined reference to `Demo::Printer::ice_isA(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x14): undefined reference to `Demo::Printer::ice_ids(Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x18): undefined reference to `Demo::Printer::ice_id(Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x28): undefined reference to `Demo::Printer::__dispatch(IceInternal::Incoming&, Ice::Current const&)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x2c): undefined reference to `Demo::Printer::__write(IceInternal::BasicStream*) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x30): undefined reference to `Demo::Printer::__read(IceInternal::BasicStream*, bool)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x34): undefined reference to `Demo::Printer::__write(IceInternal::Handle<Ice::OutputStream> const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x38): undefined reference to `Demo::Printer::__read(IceInternal::Handle<Ice::InputStream> const&, bool)'
    
  • (Continued:)
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xb8): undefined reference to `IceInternal::GCShared::__incRef()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xbc): undefined reference to `IceInternal::GCShared::__decRef()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xc8): undefined reference to `IceInternal::GCShared::__getRef() const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xcc): undefined reference to `IceInternal::GCShared::__setNoDelete(bool)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xd8): undefined reference to `Ice::Object::operator==(Ice::Object const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xdc): undefined reference to `Ice::Object::operator!=(Ice::Object const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xe0): undefined reference to `Ice::Object::operator<(Ice::Object const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xe4): undefined reference to `Ice::Object::ice_hash() const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xe8): undefined reference to `virtual thunk to Demo::Printer::ice_isA(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xec): undefined reference to `Ice::Object::ice_ping(Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xf0): undefined reference to `virtual thunk to Demo::Printer::ice_ids(Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xf4): undefined reference to `virtual thunk to Demo::Printer::ice_id(Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xf8): undefined reference to `virtual thunk to Demo::Printer::ice_clone() const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0xfc): undefined reference to `Ice::Object::ice_preMarshal()'/tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x100): undefined reference to `Ice::Object::ice_postUnmarshal()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x104): undefined reference to `virtual thunk to Demo::Printer::__dispatch(IceInternal::Incoming&, Ice::Current const&)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x108): undefined reference to `virtual thunk to Demo::Printer::__write(IceInternal::BasicStream*) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x10c): undefined reference to `virtual thunk to Demo::Printer::__read(IceInternal::BasicStream*, bool)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x110): undefined reference to `virtual thunk to Demo::Printer::__write(IceInternal::Handle<Ice::OutputStream> const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTV8PrinterI+0x114): undefined reference to `virtual thunk to Demo::Printer::__read(IceInternal::Handle<Ice::InputStream> const&, bool)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x8): undefined reference to `typeinfo for Demo::Printer'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xc): undefined reference to `Demo::Printer::ice_clone() const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x10): undefined reference to `Demo::Printer::ice_isA(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x14): undefined reference to `Demo::Printer::ice_ids(Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x18): undefined reference to `Demo::Printer::ice_id(Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x28): undefined reference to `Demo::Printer::__dispatch(IceInternal::Incoming&, Ice::Current const&)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x2c): undefined reference to `Demo::Printer::__write(IceInternal::BasicStream*) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x30): undefined reference to `Demo::Printer::__read(IceInternal::BasicStream*, bool)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x34): undefined reference to `Demo::Printer::__write(IceInternal::Handle<Ice::OutputStream> const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x38): undefined reference to `Demo::Printer::__read(IceInternal::Handle<Ice::InputStream> const&, bool)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xac): undefined reference to `typeinfo for Demo::Printer'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xb8): undefined reference to `IceInternal::GCShared::__incRef()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xbc): undefined reference to `IceInternal::GCShared::__decRef()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xc8): undefined reference to `IceInternal::GCShared::__getRef() const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xcc): undefined reference to `IceInternal::GCShared::__setNoDelete(bool)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xd8): undefined reference to `Ice::Object::operator==(Ice::Object const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xdc): undefined reference to `Ice::Object::operator!=(Ice::Object const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xe0): undefined reference to `Ice::Object::operator<(Ice::Object const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xe4): undefined reference to `Ice::Object::ice_hash() const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xe8): undefined reference to `virtual thunk to Demo::Printer::ice_isA(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ice::Current const&) const'/tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xec): undefined reference to `Ice::Object::ice_ping(Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xf0): undefined reference to `virtual thunk to Demo::Printer::ice_ids(Ice::Current const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xf4): undefined reference to `virtual thunk to Demo::Printer::ice_id(Ice::Current const&) const'/tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xf8): undefined reference to `virtual thunk to Demo::Printer::ice_clone() const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0xfc): undefined reference to `Ice::Object::ice_preMarshal()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x100): undefined reference to `Ice::Object::ice_postUnmarshal()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x104): undefined reference to `virtual thunk to Demo::Printer::__dispatch(IceInternal::Incoming&, Ice::Current const&)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x108): undefined reference to `virtual thunk to Demo::Printer::__write(IceInternal::BasicStream*) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x10c): undefined reference to `virtual thunk to Demo::Printer::__read(IceInternal::BasicStream*, bool)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x110): undefined reference to `virtual thunk to Demo::Printer::__write(IceInternal::Handle<Ice::OutputStream> const&) const'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTC8PrinterI0_N4Demo7PrinterE+0x114): undefined reference to `virtual thunk to Demo::Printer::__read(IceInternal::Handle<Ice::InputStream> const&, bool)'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN3Ice24AdapterNotFoundExceptionD1Ev+0xb): In function `Ice::AdapterNotFoundException::~AdapterNotFoundException()':
    : undefined reference to `vtable for Ice::AdapterNotFoundException'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN3Ice13UserExceptionD2Ev+0xb): In function `Ice::UserException::~UserException()':
    : undefined reference to `vtable for Ice::UserException'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN3Ice13UserExceptionD2Ev+0x16): In function `Ice::UserException::~UserException()':
    : undefined reference to `IceUtil::Exception::~Exception()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN3Ice24AdapterNotFoundExceptionC1Ev+0x19): In function `Ice::AdapterNotFoundException::AdapterNotFoundException()':
    : undefined reference to `vtable for Ice::AdapterNotFoundException'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN3Ice13UserExceptionC2Ev+0xd): In function `Ice::UserException::UserException()':
    : undefined reference to `IceUtil::Exception::Exception()'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN3Ice13UserExceptionC2Ev+0x19): In function `Ice::UserException::UserException()':
    : undefined reference to `vtable for Ice::UserException'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN4Demo7PrinterD0Ev+0x1a): In function `Demo::Printer::~Printer()':
    : undefined reference to `vtable for Demo::Printer'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN4Demo7PrinterD0Ev+0x29): In function `Demo::Printer::~Printer()':
    : undefined reference to `vtable for Demo::Printer'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN4Demo7PrinterD1Ev+0x1a): In function `Demo::Printer::~Printer()':
    : undefined reference to `vtable for Demo::Printer'
    /tmp/ccoCrAz0.o(.gnu.linkonce.t._ZN4Demo7PrinterD1Ev+0x29): In function `Demo::Printer::~Printer()':
    : undefined reference to `vtable for Demo::Printer'
    /tmp/ccoCrAz0.o(.gnu.linkonce.r._ZTI8PrinterI+0x8): undefined reference to `typeinfo for Demo::Printer'
    collect2: ld returned 1 exit status
    
  • marc
    marc Florida
    For the first problem, simply add /Ice-3.1.0/lib to your LD_LIBRARY_PATH environment variable. For example:
    $ LD_LIBRARY_PATH=/Ice-3.1.0/lib:$LD_LIBRARY_PATH
    $ export LD_LIBRARY_PATH
    

    Note that this doesn't have anything to do with Ice in particular, this is simply standard Linux/Unix system administration.

    For the second problem, you must link with the proper Ice libraries, i.e., add -lIce -lIceUtil to your command line. Also add -L/Ice-3.1.0/lib, so that the libraries can be found. Again, this is standard C/C++ development procedure for Linux/Unix, and not specific to Ice.
  • Right, but I don't know all the standard Linux/Unix stuff. So, please bear with me if I make a rather stupid mistake, okay?
  • marc
    marc Florida
    I forgot to mention that you must of course also link with the Printer.o file. In general, it is advisable to split compilation and linking:
    c++ -c ice_server.cpp -I/Ice-3.1.0/include -I./
    c++ -o ice_server ice_server.o Printer.o -L/Ice-3.1.0/lib -lIce -lIceUtil
    

    For more information, please refer to the GNU C++ compiler documentation.
  • That cleared most everything up, except for one thing. I type in:
    $ ./ice_server
    

    And then it complains about the shared libraries:
    ./ice_server: error while loading shared libraries: libIce.so.31: cannot open shared object file: No such file or directory
    

    This clearly isn't the case, as I checked the directory. But I can't seem to make the program realize that. I've tried appending the /lib and /bin directories to the PATH variable, and tried copying the libraries to the same directory as my program, but no avail. It's got to be something small that I'm missing, but I don't know what...
  • dwayne
    dwayne St. John's, Newfoundland
    It would appear that you do not have your LD_LIBRARY_PATH environment variable set correctly. It needs to include the lib directory of your Ice installation.
  • I don't think that's it, because I added it.

    (Terminal excerpt:)
    TRICK: echo $LD_LIBRARY_PATH
    /Ice-3.1.0/lib
    TRICK:
    
    (The prompt is changed, but I'm using bash)

    Is that what it's supposed to look like, or did I miss something?
  • Nevermind, I think I found it. Looks like I missed the 'export' command in the shell script.