Ogre g++ 编译时错误

发布于 2021-11-13 17:41:43 字数 5774 浏览 933 评论 2

在  Ubuntu 下,我编译并按照了所有的 ogre 库,但当我通过命令行编译的时候出错了:

g++ -o otest ogre.cpp -I `pkg-config --libs --cflags OGRE OIS` -lOgreMain -lOI

输出信息:

/tmp/cc9ndjXQ.o: In function `TutorialApplication::TutorialApplication()':ogre.cpp:(.text+0xd): undefined reference to `BaseApplication::BaseApplication()'/tmp/cc9ndjXQ.o: In function `TutorialApplication::TutorialApplication()':ogre.cpp:(.text+0x51): undefined reference to `BaseApplication::BaseApplication()'/tmp/cc9ndjXQ.o: In function `TutorialApplication::~TutorialApplication()':ogre.cpp:(.text+0xc6): undefined reference to `BaseApplication::~BaseApplication()'/tmp/cc9ndjXQ.o: In function `TutorialApplication::~TutorialApplication()':ogre.cpp:(.text+0x13a): undefined reference to `BaseApplication::~BaseApplication()'/tmp/cc9ndjXQ.o: In function `TutorialApplication::~TutorialApplication()':ogre.cpp:(.text+0x1ae): undefined reference to `BaseApplication::~BaseApplication()'/tmp/cc9ndjXQ.o: In function `main':ogre.cpp:(.text+0x44d): undefined reference to `BaseApplication::go()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xc): undefined reference to `BaseApplication::frameRenderingQueued(Ogre::FrameEvent const&)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x1c): undefined reference to `BaseApplication::go()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x20): undefined reference to `BaseApplication::setup()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x24): undefined reference to `BaseApplication::configure()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x28): undefined reference to `BaseApplication::chooseSceneManager()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x2c): undefined reference to `BaseApplication::createCamera()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x30): undefined reference to `BaseApplication::createFrameListener()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x38): undefined reference to `BaseApplication::destroyScene()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x3c): undefined reference to `BaseApplication::createViewports()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x40): undefined reference to `BaseApplication::setupResources()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x44): undefined reference to `BaseApplication::createResourceListener()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x48): undefined reference to `BaseApplication::loadResources()'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x4c): undefined reference to `BaseApplication::keyPressed(OIS::KeyEvent const&)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x50): undefined reference to `BaseApplication::keyReleased(OIS::KeyEvent const&)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x54): undefined reference to `BaseApplication::mouseMoved(OIS::MouseEvent const&)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x58): undefined reference to `BaseApplication::mousePressed(OIS::MouseEvent const&, OIS::MouseButtonID)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x5c): undefined reference to `BaseApplication::mouseReleased(OIS::MouseEvent const&, OIS::MouseButtonID)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x60): undefined reference to `BaseApplication::windowResized(Ogre::RenderWindow*)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x64): undefined reference to `BaseApplication::windowClosed(Ogre::RenderWindow*)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x7c): undefined reference to `non-virtual thunk to BaseApplication::windowResized(Ogre::RenderWindow*)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x84): undefined reference to `non-virtual thunk to BaseApplication::windowClosed(Ogre::RenderWindow*)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x9c): undefined reference to `non-virtual thunk to BaseApplication::keyPressed(OIS::KeyEvent const&)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xa0): undefined reference to `non-virtual thunk to BaseApplication::keyReleased(OIS::KeyEvent const&)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xb4): undefined reference to `non-virtual thunk to BaseApplication::mouseMoved(OIS::MouseEvent const&)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xb8): undefined reference to `non-virtual thunk to BaseApplication::mousePressed(OIS::MouseEvent const&, OIS::MouseButtonID)'/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xbc): undefined reference to `non-virtual thunk to BaseApplication::mouseReleased(OIS::MouseEvent const&, OIS::MouseButtonID)'/tmp/cc9ndjXQ.o:(.rodata._ZTI19TutorialApplication[typeinfo for TutorialApplication]+0x8): undefined reference to `typeinfo for BaseApplication'collect2: ld returned 1 exit status

这是什么问题呢?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

背叛残局 2021-11-16 07:37:04

ogre 教程里这样:

g++ -o otest *.cpp -I `pkg-config --libs --cflags OGRE OIS`
毁梦 2021-11-16 07:21:13

上述错误是运行时错误,非编译时错误

从出错信息看,你似乎没有编译所有的 cpp 文件,例如 TutorialApplication 的构造函数在哪里呢,你需要编译那个文件。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文