2010-03-03 5 views
1

Qt 4에서 Ogre 3d를 통합해야합니다. 불행히도 구식 인 몇 가지 코드와 제안을 발견했습니다. 나는이 튜토리얼Qt에 OGRE 1.7을 통합

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

그것은 오우거 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 

이 문제의 원인은 무엇이며 어떻게 해결할 수 있습니까?

답변

3

OgreBuildSettings.h의 메모리 할당자는 아마 Ogre가 실제로 빌드 된 메모리를 반영하지 않습니다. 당신이 오우거를 구축 (또는 #define OGRE_MEMORY_ALLOCATOR의 숫자와 함께 연주 할 때 사용되는로 변경합니다. 당신이 오우거를 업데이트하고 대안에 OgreBuildSettings.h을 대체하는 것을 잊지 (경로를 포함 어쩌면 프로젝트의).

1

QT4를 사용하는 예 때 발생 및 ogrewidget.cpp에서 오우거 Eihort http://www.ogre3d.org/tikiwiki/QtOgre

는 대체 ....

// 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! 

으로 ....

// 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; 

그리고 그것은 사용하기

오우거 1.7.3와 함께 작동 ...

OgreWidget * ogreWidget = 새로운 OgreWidget();