简体   繁体   English

Ogre g ++编译时错误

[英]Ogre g++ compile-time error

On ubuntu, I have compiled and installed all the ogre libraries. 在ubuntu上,我编译并安装了所有的食人魔库。 However, when I try to compile a tutorial with this command 但是,当我尝试使用此命令编译教程时

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

and it outputs 它输出

/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

Anyone know how to fix this/what I am doing wrong? 任何人都知道如何解决这个/我做错了什么?

That's not a compile time error, it's a link time error. 这不是编译时错误,它是链接时错误。

By the looks of things, you probably aren't compiling all the *.cpp files. 从外观上看,您可能没有编译所有*.cpp文件。 What file is the body of TutorialApplication 's constructor in? 什么文件是TutorialApplication的构造函数的主体? You need to compile and link with that. 你需要编译和链接。

this works on ogre tutorials : 这适用于食人魔教程:

g++ -o otest *.cpp -I `pkg-config --libs --cflags OGRE OIS` g ++ -o otest * .cpp -I`pkg-config --libs --cflags OGRE OIS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM