在 Qt 中集成 OGRE 1.7
我需要将 Ogre 3d 集成到 Qt 4 中。我发现了一些代码和建议,不幸的是它们已经过时了。我喜欢这个教程
http://irmatden.developpez.com/tutoriels/qt /integration-ogre-qt/
它适用于 Ogre 1.4.9 (Eihorn),但不适用于最新版本 1.7.0。使用最新版本编译应用程序会导致链接器错误
ogrewidget.o: In function `OgreWidget::~OgreWidget()': ogrewidget.cpp:(.text+0x5b6): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `OgreWidget::~OgreWidget()': ogrewidget.cpp:(.text+0x666): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `OgreWidget::~OgreWidget()': ogrewidget.cpp:(.text+0x6f6): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `OgreWidget::initOgreSystem()': ogrewidget.cpp:(.text+0x1cfb): undefined reference to `Ogre::NedPoolingImpl::allocBytes(unsigned int, char const*, int, char const*)' ogrewidget.cpp:(.text+0x1dde): undefined reference to `Ogre::Root::initialise(bool, std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&)' ogrewidget.cpp:(.text+0x2278): undefined reference to `Ogre::Root::createRenderWindow(std::basic_string, std::allocator > const&, unsigned int, unsigned int, bool, std::map, std::allocator >, std::basic_string, std::allocator >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > > const*)' ogrewidget.cpp:(.text+0x2c31): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair, std::allocator > const, std::basic_string, std::allocator > > const&)': ogrewidget.cpp:(.text._ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsEN4Ogre12STLAllocatorIS2_NS7_22CategorisedAllocPolicyILNS7_14MemoryCategoryE0EEEEEE10_M_insert_EPKSt18_Rb_tree_node_baseSG_RKS2_[std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair, std::allocator > const, std::basic_string, std::allocator > > const&)]+0x40): undefined reference to `Ogre::NedPoolingImpl::allocBytes(unsigned int, char const*, int, char const*)' ogrewidget.cpp:(.text._ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsEN4Ogre12STLAllocatorIS2_NS7_22CategorisedAllocPolicyILNS7_14MemoryCategoryE0EEEEEE10_M_insert_EPKSt18_Rb_tree_node_baseSG_RKS2_[std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair, std::allocator > const, std::basic_string, std::allocator > > const&)]+0x10d): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_erase(std::_Rb_tree_node, std::allocator > const, std::basic_string, std::allocator > > >*)': ogrewidget.cpp:(.text._ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsEN4Ogre12STLAllocatorIS2_NS7_22CategorisedAllocPolicyILNS7_14MemoryCategoryE0EEEEEE8_M_eraseEPSt13_Rb_tree_nodeIS2_E[std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_erase(std::_Rb_tree_node, std::allocator > const, std::basic_string, std::allocator > > >*)]+0x47): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' collect2: ld returned 1
可能会导致此错误的原因是什么以及如何解决它?
I need to integrate Ogre 3d in Qt 4. I found several codes and suggestions which are unfortunately out-dated. I liked this tutorial
http://irmatden.developpez.com/tutoriels/qt/integration-ogre-qt/
It works with Ogre 1.4.9 (Eihorn) but not with the recent version 1.7.0. Compiling the app with the recent one results in a linker error
ogrewidget.o: In function `OgreWidget::~OgreWidget()': ogrewidget.cpp:(.text+0x5b6): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `OgreWidget::~OgreWidget()': ogrewidget.cpp:(.text+0x666): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `OgreWidget::~OgreWidget()': ogrewidget.cpp:(.text+0x6f6): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `OgreWidget::initOgreSystem()': ogrewidget.cpp:(.text+0x1cfb): undefined reference to `Ogre::NedPoolingImpl::allocBytes(unsigned int, char const*, int, char const*)' ogrewidget.cpp:(.text+0x1dde): undefined reference to `Ogre::Root::initialise(bool, std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&)' ogrewidget.cpp:(.text+0x2278): undefined reference to `Ogre::Root::createRenderWindow(std::basic_string, std::allocator > const&, unsigned int, unsigned int, bool, std::map, std::allocator >, std::basic_string, std::allocator >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > > const*)' ogrewidget.cpp:(.text+0x2c31): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair, std::allocator > const, std::basic_string, std::allocator > > const&)': ogrewidget.cpp:(.text._ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsEN4Ogre12STLAllocatorIS2_NS7_22CategorisedAllocPolicyILNS7_14MemoryCategoryE0EEEEEE10_M_insert_EPKSt18_Rb_tree_node_baseSG_RKS2_[std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair, std::allocator > const, std::basic_string, std::allocator > > const&)]+0x40): undefined reference to `Ogre::NedPoolingImpl::allocBytes(unsigned int, char const*, int, char const*)' ogrewidget.cpp:(.text._ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsEN4Ogre12STLAllocatorIS2_NS7_22CategorisedAllocPolicyILNS7_14MemoryCategoryE0EEEEEE10_M_insert_EPKSt18_Rb_tree_node_baseSG_RKS2_[std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair, std::allocator > const, std::basic_string, std::allocator > > const&)]+0x10d): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' ogrewidget.o: In function `std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_erase(std::_Rb_tree_node, std::allocator > const, std::basic_string, std::allocator > > >*)': ogrewidget.cpp:(.text._ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsEN4Ogre12STLAllocatorIS2_NS7_22CategorisedAllocPolicyILNS7_14MemoryCategoryE0EEEEEE8_M_eraseEPSt13_Rb_tree_nodeIS2_E[std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::basic_string, std::allocator > >, std::_Select1st, std::allocator > const, std::basic_string, std::allocator > > >, std::less, std::allocator > >, Ogre::STLAllocator, std::allocator > const, std::basic_string, std::allocator > >, Ogre::CategorisedAllocPolicy > >::_M_erase(std::_Rb_tree_node, std::allocator > const, std::basic_string, std::allocator > > >*)]+0x47): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)' collect2: ld returned 1
What might cause this and how do I solve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
OgreBuildSettings.h
的内存分配器可能并不反映 Ogre 实际构建时使用的内存分配器。将其更改为您构建 Ogre 时使用的值(或者只是使用#define OGRE_MEMORY_ALLOCATOR
的数字。当您更新 Ogre 并忘记替换OgreBuildSettings.h
时,就会发生这种情况替代包含路径(可能是您的项目的)。The memory allocator of your
OgreBuildSettings.h
probably doesn't reflect the one Ogre was actually built with. Change it to the one used when you built Ogre (or just play with the numbers of#define OGRE_MEMORY_ALLOCATOR
. It happens when you update Ogre and forget to replaceOgreBuildSettings.h
in an alternative include path (maybe your project's).使用 QT4 和 Ogre Eihort 的示例
http://www.ogre3d.org/tikiwiki/QtOgre
在 ogrewidget.cpp 中只需替换 .. ..
与....
它适用于 Ogre 1.7.3
要使用...
OgreWidget *ogreWidget = new OgreWidget();
An Example using QT4 and Ogre Eihort
http://www.ogre3d.org/tikiwiki/QtOgre
In ogrewidget.cpp just replace....
With....
And it works with Ogre 1.7.3
To use...
OgreWidget *ogreWidget = new OgreWidget();