linux - C++ linker errors, Undefined references to Items that should be referenced from a Share Object -


i building library, called physgameengine, aid in building games. game library links against several libraries, including: ogre3d, bullet physics , sdl, in library files libogremain-1.6.5.so, libbulletcollision.a, libbulletdynamics.a, libbulletsoftbody.a, libsdl-1.2.so.0. library/shared object appears build fine in ubuntu 9.10, using gcc , code::blocks. build fine on windows mingw , code::blocks.

in windows can make games compile/link using library built fine, programs run , expect to. in ubuntu when try compile/link game uses library making lots of undefined reference errors. none functions or objects in library built, rather items library calls. here example of errors get.

> ||warning: libogremain-1.6.5.so, needed ../physgameengine/bin/ubuntudebug/libphysgame.so, not found (try using -rpath or -rpath-link)| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::root::root(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::stringutil::blank'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionworld::updateaabbs()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::root::createrenderwindow(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int, bool, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const*)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::timer::getmilliseconds()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::root::createscenemanager(unsigned short, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::root::~root()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionworld::~btcollisionworld()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::root::renderoneframe()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionobject::btcollisionobject()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::timer::getmillisecondscpu()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btsimulationislandmanager::buildandprocessislands(btdispatcher*, btcollisionworld*, btsimulationislandmanager::islandcallback*)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::viewport::getactualwidth() const'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::root::initialise(bool, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::camera::lookat(ogre::vector3 const&)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionworld::removecollisionobject(btcollisionobject*)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::viewport::getactualheight() const'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::timer::reset()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::root::restoreconfig()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::timer::~timer()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::nedallocimpl::deallocbytes(void*)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionworld::convexsweeptest(btconvexshape const*, bttransform const&, bttransform const&, btcollisionworld::convexresultcallback&, float) const'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::nedallocimpl::allocbytes(unsigned int, char const*, int, char const*)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `typeinfo btcollisionworld'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionobject::~btcollisionobject()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btsimulationislandmanager::btsimulationislandmanager()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::root::showconfigdialog()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionobject::setactivationstate(int)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::logmanager::getsingleton()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionworld::performdiscretecollisiondetection()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::logmanager::logmessage(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ogre::logmessagelevel, bool)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::timer::timer()'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionworld::btcollisionworld(btdispatcher*, btbroadphaseinterface*, btcollisionconfiguration*)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `typeinfo btcollisionobject'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `ogre::camera::setposition(ogre::vector3 const&)'| ../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference `btcollisionworld::addcollisionobject(btcollisionobject*, short, short)'| ||=== build finished: 36 errors, 1 warnings ===| 

the bulk of code identical between windows , linux seem have equivalent compile/linker settings. linux game appears linking against original libraries library should linking against. going on? ideas on how fix it?

unlike in windows, in linux systems it's not enough place shared library file same folder executable.

you should either provide ld_library_path variable or follow linker's advice , use -rpath (check this question)


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -