OrgeのVS 2008での構成方法
10275 ワード
<一>.VS 2008をインストールします.
<二>.VS 2008 SP 1をインストールします(一定の耐性が必要です).
<三>.OgreSDKをインストールします.アドレスhttp://downloads.sourceforge.net/ogre/OgreSDKSetup1.6.0RC1_VC90.exe
VS 2008のみ対応.
<四>.VS 2008を開き、プロジェクトExampleを新規作成し、ソースファイルExampleを追加します.cpp
<五>.IDE環境の設定(手順は以下のとおり)
デバッグ-->
作業ディレクトリは「..OgreSDKbindebug」(Ogreを正常に動作させるdllがある)です.
C/C++-->
一般->追加は、ディレクトリに3つのディレクトリを追加します:("..OgreSDKProjectExampleinclude"...OgreSDKinclude"...OgreSDKsamplesinclude");
C/C++-->
コード生成->
ランタイムライブラリは「マルチスレッドデバッグDLL(/MDd)」(これはデフォルトのようです).
リンカー->
一般->
出力ファイルは「..OgreSDKbindebug$(ProjectName).exe」です.
リンカー->
一般->
追加ライブラリディレクトリに「..OgreSDKlib」を追加します.
リンカー->
入力->
依存項目の追加に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.. (.OgreSDKbindebugPlugins.cfgを削除して保存):
<八>.実行を開始すると、exeファイルは「..OgreSDKbindebugExample.exe」になります.
実行結果:
<二>.VS 2008 SP 1をインストールします(一定の耐性が必要です).
<三>.OgreSDKをインストールします.アドレスhttp://downloads.sourceforge.net/ogre/OgreSDKSetup1.6.0RC1_VC90.exe
VS 2008のみ対応.
<四>.VS 2008を開き、プロジェクトExampleを新規作成し、ソースファイルExampleを追加します.cpp
<五>.IDE環境の設定(手順は以下のとおり)
デバッグ-->
作業ディレクトリは「..OgreSDKbindebug」(Ogreを正常に動作させるdllがある)です.
C/C++-->
一般->追加は、ディレクトリに3つのディレクトリを追加します:("..OgreSDKProjectExampleinclude"...OgreSDKinclude"...OgreSDKsamplesinclude");
C/C++-->
コード生成->
ランタイムライブラリは「マルチスレッドデバッグDLL(/MDd)」(これはデフォルトのようです).
リンカー->
一般->
出力ファイルは「..OgreSDKbindebug$(ProjectName).exe」です.
リンカー->
一般->
追加ライブラリディレクトリに「..OgreSDKlib」を追加します.
リンカー->
入力->
依存項目の追加に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.. (.OgreSDKbindebugPlugins.cfgを削除して保存):
Plugin=Plugin_PCZSceneManager_d.dll Plugin=Plugin_OctreeZone_d.dll
<八>.実行を開始すると、exeファイルは「..OgreSDKbindebugExample.exe」になります.
実行結果: