Ogre 3D开发环境配置中遇到的问题(1)

昨天正式开始了OGRE的学习之旅,第一件事肯定就是配置OGRE的开发环境了。

我的系统配置为:OS: Win7 X64,Compiler:VS 2010,然后就是百度各种配置方法了,我尝试过1.7和1.8两种版本的OGRE SDK,但OGRE SDK 1.8之前的版本都需要下载依赖库,而且依赖库的版本又是多种多样,在编译依赖库的时候,总是会出现各种各样的编译错误,在辛辛苦苦解决了依赖库的编译问题之后,再对OGRE SDK进行编译,然而OGRE SDK和依赖库的版本不兼容,又是各种编译错误啊!编译--解决编译问题,一整天就这样过去了,但依然没能让OGRE Sample跑起来,让人抓狂啊有木有!

OGRE开源项目的开发人员,你们是不是存心不让人学习OGRE啊?

于是又去OGRE官网下载了OgreSDK_vc10_v1-9-0unstable版本,OK,编译、链接通过!

接着将Ogre_VC10_AppWizard_1.8.0安装在OGRE SDK的目录下,然后新建一个OGRE工程。main.cpp的代码如下:

#include "OGRE/ExampleApplication.h"

class Example1 : public ExampleApplication
{
public:
void createScene()
{
mSceneMgr->setAmbientLight(ColourValue(1.0, 1.0, 1.0));

Ogre::Entity* ent = mSceneMgr->createEntity("MyEntity", "Sinbad.mesh");
mSceneMgr->getRootSceneNode()->attachObject(ent);
}
};

int WINAPI CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
Example1 app;
app.go();

return 0;
}


结果可想而知,最新版本的Ogre SDK 1.9与OGRE项目模板的版本又不兼容!会出现如下几个问题:

1.fatal error C1083: 无法打开包括文件:“OgreOverlayElement.h”: No such file or directory

解决方法:

工程右键-》属性-》配置属性-》C/C++-》常规附件包含目录-》添加如下路径: 

$(OGRE_HOME)\include\OGRE\Overlay


2.error C2065: “OverlayElement”: 未声明的标识符

error C2653: “OverlayManager”: 不是类或命名空间名称

解决方法:

在exampframelistener.h头文件中加入如下两条包含语句

#include "OgreOverlayElement.h"
#include "OgreOverlayManager.h"


3.error C2664: 'OgreBites::SdkTrayManager::SdkTrayManager(const Ogre::String &,Ogre::RenderWindow *,

OgreBites::InputContext,OgreBites::SdkTrayListener *)': can not covert Parameters 3 from'OIS::Mouse *' to 

'OgreBites::InputContext' .

解决方法:

定位到错误点,进行如下修改-->

OgreBites::InputContext inputContext;
inputContext.mMouse = m_pMouse; 
inputContext.mKeyboard = m_pKeyboard;
m_pTrayMgr = new OgreBites::SdkTrayManager("TrayMgr", m_pRenderWnd, inputContext, this);


4. BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: class Ogre::OverlayContainer * __thiscall Ogre::Overlay::getChild(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?getChild@Overlay@Ogre@@QAEPAVOverlayContainer@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) в функции "protected: void __thiscall OgreBites::SdkTrayManager::setExpandedMenu(class OgreBites::SelectMenu *)" (?setExpandedMenu@SdkTrayManager@OgreBites@@IAEXPAVSelectMenu@2@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::Overlay::setZOrder(unsigned short)" (__imp_?setZOrder@Overlay@Ogre@@QAEXG@Z) в функции "public: __thiscall OgreBites::SdkTrayManager::SdkTrayManager(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Ogre::RenderWindow *,struct OgreBites::InputContext,class OgreBites::SdkTrayListener *)" (??0SdkTrayManager@OgreBites@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVRenderWindow@Ogre@@UInputContext@1@PAVSdkTrayListener@1@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: bool __thiscall Ogre::Overlay::isVisible(void)const " (__imp_?isVisible@Overlay@Ogre@@QBE_NXZ) в функции "public: bool __thiscall OgreBites::SdkTrayManager::injectMouseDown(class OIS::MouseEvent const &,enum OIS::MouseButtonID)" (?injectMouseDown@SdkTrayManager@OgreBites@@QAE_NABVMouseEvent@OIS@@W4MouseButtonID@4@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::Overlay::show(void)" (__imp_?show@Overlay@Ogre@@QAEXXZ) в функции "public: void __thiscall OgreBites::SdkTrayManager::showCursor(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?showCursor@SdkTrayManager@OgreBites@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::Overlay::hide(void)" (__imp_?hide@Overlay@Ogre@@QAEXXZ) в функции "public: void __thiscall OgreBites::SdkTrayManager::hideCursor(void)" (?hideCursor@SdkTrayManager@OgreBites@@QAEXXZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::Overlay::add2D(class Ogre::OverlayContainer *)" (__imp_?add2D@Overlay@Ogre@@QAEXPAVOverlayContainer@2@@Z) в функции "public: __thiscall OgreBites::SdkTrayManager::SdkTrayManager(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Ogre::RenderWindow *,struct OgreBites::InputContext,class OgreBites::SdkTrayListener *)" (??0SdkTrayManager@OgreBites@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVRenderWindow@Ogre@@UInputContext@1@PAVSdkTrayListener@1@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::Overlay::remove2D(class Ogre::OverlayContainer *)" (__imp_?remove2D@Overlay@Ogre@@QAEXPAVOverlayContainer@2@@Z) в функции "protected: void __thiscall OgreBites::SdkTrayManager::setExpandedMenu(class OgreBites::SelectMenu *)" (?setExpandedMenu@SdkTrayManager@OgreBites@@IAEXPAVSelectMenu@2@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __thiscall Ogre::OverlayElement::getName(void)const " (__imp_?getName@OverlayElement@Ogre@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) в функции "public: class Ogre::OverlayElement * __thiscall OgreBites::SdkTrayManager::getCursorImage(void)" (?getCursorImage@SdkTrayManager@OgreBites@@QAEPAVOverlayElement@Ogre@@XZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: bool __thiscall Ogre::OverlayElement::isVisible(void)const " (__imp_?isVisible@OverlayElement@Ogre@@QBE_NXZ) в функции "public: bool __thiscall OgreBites::SdkTrayManager::frameRenderingQueued(struct Ogre::FrameEvent const &)" (?frameRenderingQueued@SdkTrayManager@OgreBites@@QAE_NABUFrameEvent@Ogre@@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::OverlayElement::setDimensions(float,float)" (__imp_?setDimensions@OverlayElement@Ogre@@QAEXMM@Z) в функции "public: virtual void __thiscall OgreBites::SdkTrayManager::adjustTrays(void)" (?adjustTrays@SdkTrayManager@OgreBites@@UAEXXZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::OverlayElement::setPosition(float,float)" (__imp_?setPosition@OverlayElement@Ogre@@QAEXMM@Z) в функции "public: virtual void __thiscall OgreBites::SdkTrayManager::adjustTrays(void)" (?adjustTrays@SdkTrayManager@OgreBites@@UAEXXZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::OverlayElement::setWidth(float)" (__imp_?setWidth@OverlayElement@Ogre@@QAEXM@Z) в функции "public: __thiscall OgreBites::Label::Label(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Ogre::UTFString const &,float)" (??0Label@OgreBites@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVUTFString@Ogre@@M@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: float __thiscall Ogre::OverlayElement::getWidth(void)const " (__imp_?getWidth@OverlayElement@Ogre@@QBEMXZ) в функции "public: virtual void __thiscall OgreBites::SdkTrayManager::adjustTrays(void)" (?adjustTrays@SdkTrayManager@OgreBites@@UAEXXZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::OverlayElement::setHeight(float)" (__imp_?setHeight@OverlayElement@Ogre@@QAEXM@Z) в функции "public: __thiscall OgreBites::ParamsPanel::ParamsPanel(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,float,unsigned int)" (??0ParamsPanel@OgreBites@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MI@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: float __thiscall Ogre::OverlayElement::getHeight(void)const " (__imp_?getHeight@OverlayElement@Ogre@@QBEMXZ) в функции "public: virtual void __thiscall OgreBites::SdkTrayManager::adjustTrays(void)" (?adjustTrays@SdkTrayManager@OgreBites@@UAEXXZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::OverlayElement::setLeft(float)" (__imp_?setLeft@OverlayElement@Ogre@@QAEXM@Z) в функции "public: virtual void __thiscall OgreBites::SdkTrayManager::adjustTrays(void)" (?adjustTrays@SdkTrayManager@OgreBites@@UAEXXZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: float __thiscall Ogre::OverlayElement::getLeft(void)const " (__imp_?getLeft@OverlayElement@Ogre@@QBEMXZ) в функции "public: virtual void __thiscall OgreBites::SdkTrayManager::adjustTrays(void)" (?adjustTrays@SdkTrayManager@OgreBites@@UAEXXZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::OverlayElement::setTop(float)" (__imp_?setTop@OverlayElement@Ogre@@QAEXM@Z) в функции "public: virtual void __thiscall OgreBites::SdkTrayManager::adjustTrays(void)" (?adjustTrays@SdkTrayManager@OgreBites@@UAEXXZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: float __thiscall Ogre::OverlayElement::getTop(void)const " (__imp_?getTop@OverlayElement@Ogre@@QBEMXZ) в функции "public: __thiscall OgreBites::ParamsPanel::ParamsPanel(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,float,unsigned int)" (??0ParamsPanel@OgreBites@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MI@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: class Ogre::OverlayContainer * __thiscall Ogre::OverlayElement::getParent(void)" (__imp_?getParent@OverlayElement@Ogre@@QAEPAVOverlayContainer@2@XZ) в функции "public: static void __cdecl OgreBites::Widget::nukeOverlayElement(class Ogre::OverlayElement *)" (?nukeOverlayElement@Widget@OgreBites@@SAXPAVOverlayElement@Ogre@@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: class Ogre::Overlay * __thiscall Ogre::OverlayManager::create(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?create@OverlayManager@Ogre@@QAEPAVOverlay@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) в функции "public: __thiscall OgreBites::SdkTrayManager::SdkTrayManager(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Ogre::RenderWindow *,struct OgreBites::InputContext,class OgreBites::SdkTrayListener *)" (??0SdkTrayManager@OgreBites@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVRenderWindow@Ogre@@UInputContext@1@PAVSdkTrayListener@1@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::OverlayManager::destroy(class Ogre::Overlay *)" (__imp_?destroy@OverlayManager@Ogre@@QAEXPAVOverlay@2@@Z) в функции "public: virtual __thiscall OgreBites::SdkTrayManager::~SdkTrayManager(void)" (??1SdkTrayManager@OgreBites@@UAE@XZ)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: int __thiscall Ogre::OverlayManager::getViewportHeight(void)const " (__imp_?getViewportHeight@OverlayManager@Ogre@@QBEHXZ) в функции "public: static bool __cdecl OgreBites::Widget::isCursorOver(class Ogre::OverlayElement *,class Ogre::Vector2 const &,float)" (?isCursorOver@Widget@OgreBites@@SA_NPAVOverlayElement@Ogre@@ABVVector2@4@M@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: int __thiscall Ogre::OverlayManager::getViewportWidth(void)const " (__imp_?getViewportWidth@OverlayManager@Ogre@@QBEHXZ) в функции "public: static bool __cdecl OgreBites::Widget::isCursorOver(class Ogre::OverlayElement *,class Ogre::Vector2 const &,float)" (?isCursorOver@Widget@OgreBites@@SA_NPAVOverlayElement@Ogre@@ABVVector2@4@M@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: class Ogre::OverlayElement * __thiscall Ogre::OverlayManager::createOverlayElement(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (__imp_?createOverlayElement@OverlayManager@Ogre@@QAEPAVOverlayElement@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0_N@Z) в функции "public: __thiscall OgreBites::SdkTrayManager::SdkTrayManager(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Ogre::RenderWindow *,struct OgreBites::InputContext,class OgreBites::SdkTrayListener *)" (??0SdkTrayManager@OgreBites@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVRenderWindow@Ogre@@UInputContext@1@PAVSdkTrayListener@1@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::OverlayManager::destroyOverlayElement(class Ogre::OverlayElement *,bool)" (__imp_?destroyOverlayElement@OverlayManager@Ogre@@QAEXPAVOverlayElement@2@_N@Z) в функции "public: static void __cdecl OgreBites::Widget::nukeOverlayElement(class Ogre::OverlayElement *)" (?nukeOverlayElement@Widget@OgreBites@@SAXPAVOverlayElement@Ogre@@@Z)
1>BaseApplication.obj : error LNK2019: Link unresolved external symbol "__declspec(dllimport) public: class Ogre::OverlayElement * __thiscall Ogre::OverlayManager::createOverlayElementFromTemplate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (__imp_?createOverlayElementFromTemplate@OverlayManager@Ogre@@QAEPAVOverlayElement@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00_N@Z) в функции "public: __thiscall OgreBites::DecorWidget::DecorWidget(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0DecorWidget@OgreBites@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)

解决方法:

配置属性 - 链接器 - 输入 - 附加依赖项 - 为程序的Debug版本添加输入库文件 : OgreOverlay_d.lib.
配置属性 - 链接器 - 输入 - 附加依赖项 - 为程序的Release版本添加输入库文件: OgreOverlay.lib.


再次说明一下,我的环境配置:

OS:Win7 X64

Compiler:VS 2010

OGRE SDK:OgreSDK_vc10_v1-9-0unstable

Template:Ogre_VC10_AppWizard_1.8.0


为了配置OGRE的开发环境,我花费了一天的时间,但我觉得很值得!期间遇到了很多的问题,不知何从下手,

索引擎是个很好的工具,Google很强大,某度就算了,基本不能解决技术问题!在搜索时我看到了一个人的博客,

他说:”如果是新手的话,建议放弃OgreSDK 1.9,不要浪费时间。“这个我不认同,可能他的观点是对的,但我不

甘于在困难面前屈服!我就是OGRE的新手,以我配置OGRE的经历来看,OgreSDK 1.9集成了所需的各种库文件

和头文件等,为新手避免了各种不必要的麻烦,节省了新手的大量时间,OgreSDK 1.9 is for the beginers!


附图一张,Hello,OGRE:


评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值