Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/136.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ C++;链接器错误,对应该从共享对象引用的项的未定义引用_C++_Linux_Gcc_Linker_Undefined Reference - Fatal编程技术网

C++ C++;链接器错误,对应该从共享对象引用的项的未定义引用

C++ C++;链接器错误,对应该从共享对象引用的项的未定义引用,c++,linux,gcc,linker,undefined-reference,C++,Linux,Gcc,Linker,Undefined Reference,我正在建立一个名为physgameengine的图书馆,以帮助构建游戏。此游戏库链接了几个库,包括:Ogre3d、Bullet Physics和SDL,它们位于库文件libogleme-1.6.5.so、libBulletCollision.a、libBulletDynamics.a、libBulletSoftBody.a、libSDL-1.2.so.0中。这个库/共享对象在Ubuntu9.10中使用GCC和Code::blocks构建得很好。它在带有mingw和Code::Block的wind

我正在建立一个名为physgameengine的图书馆,以帮助构建游戏。此游戏库链接了几个库,包括:Ogre3d、Bullet Physics和SDL,它们位于库文件libogleme-1.6.5.so、libBulletCollision.a、libBulletDynamics.a、libBulletSoftBody.a、libSDL-1.2.so.0中。这个库/共享对象在Ubuntu9.10中使用GCC和Code::blocks构建得很好。它在带有mingw和Code::Block的windows上构建得很好

在windows中,我可以使用我构建的库制作编译/链接的游戏,这些程序运行起来,完全符合我的预期。在Ubuntu中,当我试图编译/链接一个使用这个库的游戏时,我会遇到很多未定义的引用错误。但是对于我构建的库中的函数或对象,没有一个,而是对于我的库调用的项。下面是我遇到的错误的一个例子

> ||warning: libOgreMain-1.6.5.so, needed by ../physgameengine/bin/ubuntudebug/libphysgame.so, not found (try using -rpath or -rpath-link)|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `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 to `Ogre::StringUtil::BLANK'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionWorld::updateAabbs()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `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 to `Ogre::Timer::getMilliseconds()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Root::createSceneManager(unsigned short, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Root::~Root()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionWorld::~btCollisionWorld()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Root::renderOneFrame()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionObject::btCollisionObject()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Timer::getMillisecondsCPU()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btSimulationIslandManager::buildAndProcessIslands(btDispatcher*, btCollisionWorld*, btSimulationIslandManager::IslandCallback*)'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Viewport::getActualWidth() const'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `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 to `Ogre::Camera::lookAt(Ogre::Vector3 const&)'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionWorld::removeCollisionObject(btCollisionObject*)'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Viewport::getActualHeight() const'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Timer::reset()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Root::restoreConfig()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Timer::~Timer()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::NedAllocImpl::deallocBytes(void*)'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionWorld::convexSweepTest(btConvexShape const*, btTransform const&, btTransform const&, btCollisionWorld::ConvexResultCallback&, float) const'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::NedAllocImpl::allocBytes(unsigned int, char const*, int, char const*)'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `typeinfo for btCollisionWorld'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionObject::~btCollisionObject()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btSimulationIslandManager::btSimulationIslandManager()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Root::showConfigDialog()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionObject::setActivationState(int)'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::LogManager::getSingleton()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionWorld::performDiscreteCollisionDetection()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `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 to `Ogre::Timer::Timer()'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionWorld::btCollisionWorld(btDispatcher*, btBroadphaseInterface*, btCollisionConfiguration*)'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `typeinfo for btCollisionObject'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `Ogre::Camera::setPosition(Ogre::Vector3 const&)'|
../physgameengine/bin/ubuntudebug/libphysgame.so||undefined reference to `btCollisionWorld::addCollisionObject(btCollisionObject*, short, short)'|
||=== Build finished: 36 errors, 1 warnings ===|
||警告:未找到../physgameengine/bin/ubuntudebug/libphysgame.so所需的libogleme-1.6.5.so(请尝试使用-rpath或-rpath链接)|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`Ogre::Root::Root(std::basic_string const&,std::basic_string const&,std::basic_string const&)`|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“Ogre::StringUtil::BLANK”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionWorld::UpdateAbbs()的引用”|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`Ogre::Root::createRenderWindow(std::basic_string const&,unsigned int,unsigned int,bool,std::map const*)的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`Ogre::Timer::getmillizes()'的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`Ogre::Root::createSceneManager(unsigned short,std::basic_string const&')的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对'Ogre::Root::~Root()的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对'btCollisionWorld::~btCollisionWorld()'的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“Ogre::Root::renderOneFrame()”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionObject::btCollisionObject()”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`Ogre::Timer::getMillistSecondSCPU()'的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“BTSimulationLandManager::buildAndProcessIslands(btDispatcher*、btCollisionWorld*、BTSimulationLandManager::IslandCallback*)的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`Ogre::Viewport::getActualWidth()const'的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | | |未定义对“Ogre::Root::initialise(bool,std::basic_string const&,std::basic_string const&)”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“食人魔::摄影机::注视(食人魔::矢量3常量&)”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionWorld::removeCollisionObject(btCollisionObject*)”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`Ogre::Viewport::getActualHeight()const'的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`Ogre::Timer::reset()'的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“Ogre::Root::restoreConfig()的引用”|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对'Ogre::Timer::~Timer()'的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“Ogre::NedAllocImpl::deallocBytes(void*)”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionWorld::convexSweepTest(btConvexShape常量*、btTransform常量&、btTransform常量&、btCollisionWorld::ConvexResultCallback&、float)常量”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`Ogre::NedAllocImpl::allocBytes(unsigned int,char const*,int,char const*)的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionWorld的类型信息”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对`btCollisionObject::~btCollisionObject()'的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“BTSimulationLandManager::BTSimulationLandManager()的引用”|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“Ogre::Root::showConfigDialog()的引用”|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionObject::setActivationState(int)”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“Ogre::LogManager::getSingleton()的引用”|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionWorld::performDiscreteCollisionDetection()”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“Ogre::LogManager::logMessage(std::basic_string const&,Ogre::LogMessageLevel,bool)”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对'Ogre::Timer::Timer()'的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionWorld::btCollisionWorld(btDispatcher*,btBroadphaseInterface*,btCollisionConfiguration*)”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionObject的类型信息”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“Ogre::Camera::setPosition(Ogre::Vector3 const&)”的引用|
../physgameengine/bin/ubuntudebug/libphysgame.so | |未定义对“btCollisionWorld::addCollisionObject(btCollisionObject*,short,short)”的引用|
||==构建完成:36个错误,1个警告===|
windows和Linux之间的大部分代码是相同的,它们似乎具有等效的编译/链接器设置。但Linux游戏似乎与最初的libr相关联
> ||warning: libOgreMain-1.6.5.so, needed by ../physgameengine/bin/ubuntudebug/libphysgame.so, not found (try using -rpath or -rpath-link)|
libOgreMain-1.6.5.so, needed by libphysgame.so, not found (try using -rpath or -rpath-link)|
gcc -Wl,-rpath-link,/opt/lib ...rest of linker line...