2010-03-03 6 views
1

J'ai besoin d'intégrer Ogre 3d dans Qt 4. J'ai trouvé plusieurs codes et suggestions qui sont malheureusement obsolètes. J'ai aimé ce tutorielIntégrer OGRE 1.7 dans Qt

http://irmatden.developpez.com/tutoriels/qt/integration-ogre-qt/

Il fonctionne avec Ogre 1.4.9 (Eihorn) mais pas avec la version la plus récente 1.7.0. Compiler l'application avec les derniers résultats un dans une erreur de liens

 
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 

Que pourrait faire cela et comment puis-je résoudre?

Répondre

3

L'allocateur de mémoire de votre OgreBuildSettings.h ne reflète probablement pas celui dans lequel Ogre a été réellement construit. Changez-le à celui utilisé lorsque vous avez construit Ogre (ou tout simplement jouer avec les chiffres de #define OGRE_MEMORY_ALLOCATOR. Cela se produit lorsque vous mettez à jour Ogre et oubliez de remplacer OgreBuildSettings.h dans un autre chemin d'inclusion (peut-être votre projet de).

1

Exemple d'utilisation QT4 et Ogre Eihort http://www.ogre3d.org/tikiwiki/QtOgre

En ogrewidget.cpp simplement remplacer ....

// setup a renderer 
    Ogre::RenderSystemList *renderers = mOgreRoot->getAvailableRenderers(); 
    assert(!renderers->empty()); // we need at least one renderer to do anything useful 

    Ogre::RenderSystem *renderSystem; 
    renderSystem = chooseRenderer(renderers); 

    assert(renderSystem); // user might pass back a null renderer, which would be bad! 

Avec ....

// setup a renderer 
    Ogre::RenderSystemList::const_iterator renderers = mOgreRoot->getAvailableRenderers().begin(); 
    while(renderers != mOgreRoot->getAvailableRenderers().end()) 
    { 
     Ogre::String rName = (*renderers)->getName(); 
     if (rName == "OpenGL Rendering Subsystem") 
      break; 
     renderers++; 
    } 

    Ogre::RenderSystem *renderSystem = *renderers; 

Et cela fonctionne avec Ogre 1.7.3

Pour utiliser ...

OgreWidget * ogreWidget = new OgreWidget();

Questions connexes