當前位置:編程學習大全網 - 編程語言 - 如何配置VS2008下的ogre環境

如何配置VS2008下的ogre環境

<壹>.安裝VS2008。

<二>.安裝VS2008SP1

<三>.安裝OgreSDK。對應VS2008.

<四>.打開VS2008,新建項目Example,添加源文件Example.cpp

<五>.設置IDE環境(步驟如下)

調試-->工作目錄為"..\OgreSDK\bin\debug"(這裏有使Ogre能正常工作的dll);

C/C++-->常規-->附加包含目錄中加三個目錄:("..\OgreSDK\Project\Example\include""..\OgreSDK\include""..\OgreSDK\samples\include");

C/C++-->代碼生成-->運行時庫"為"多線程調試 DLL (/MDd)"(這個好像是默認的);

鏈接器-->常規-->輸出文件為"..\OgreSDK\bin\debug\$(ProjectName).exe" ;

鏈接器-->常規-->附加庫目錄中添加"..\OgreSDK\lib";

鏈接器-->輸入-->附加依賴項中添加"OgreMain_d.lib"和"OIS_d.lib"(如果是Release版則添加"OgreMain.lib"和"OIS.lib")

<六>.添加以下代碼:

#include "ExampleApplication.h"

class MyApplication : public ExampleApplication

{

protected:

public:

MyApplication()

{

}

~MyApplication()

{

}

protected:

void createScene(void)

{

}

};

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32

#define WIN32_LEAN_AND_MEAN

#include "windows.h"

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )

#else

int main(int argc, char **argv)

#endif

{

// Create application object

MyApplication app;

try {

app.go();

} catch( Exception& e ) {

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32

MessageBoxA( NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);

#else

fprintf(stderr, "An exception has occurred: %s ",

e.getFullDescription().c_str());

#endif

}

return 0;

}

<七>.If you get an Ogre Exception which complains about being unable to load a dynamic plugin then go to ..\OgreSDK\bin\debug\Plugins.cfg and take out the following lines..

(去..\OgreSDK\bin\debug\Plugins.cfg刪除以下行並保存):

Plugin=Plugin_PCZSceneManager_d.dll Plugin=Plugin_OctreeZone_d.dll

<八>.開始執行,exe文件會在"..\OgreSDK\bin\debug\Example.exe"。

運行結果為帶ogre的logo黑屏

  • 上一篇:小學生編程課有必要學嗎
  • 下一篇:自動化立體倉庫應用存在的問題及解決措施畢業論文
  • copyright 2024編程學習大全網