Ogre+Code::Block配置

来源:互联网 发布:c语言能做界面吗 编辑:程序博客网 时间:2024/05/17 01:11
整理过的版本,经测试
http://blog.sina.com.cn/s/blog_503188a00100q9av.html
==========================================================
用OGRE 1.7 + Mingw + Code::Block安装似乎更简单一点。
上面三个东东安装好,然后用Code::Block检测到GCC建立一个OGRE工程。
接下来
如果出现下面这个提示:
"The path you entered seems valid, but wizard can't locate OGRE's files in it..."
copie all files which are here : C:\OgreSDK_mingw_v1-7-0\include\OGRE
in C:\OgreSDK_mingw_v1-7-0\include
and 
copie all files which are here : C:\OgreSDK_mingw_v1-7-0\include\OIS
in C:\OgreSDK_mingw_v1-7-0\include
and copi the folder boost which is in C:\OgreSDK_mingw_v1-7-0\boost_1_42/
in C:\OgreSDK_mingw_v1-7-0\include/
===============
OGRE 1.7.0和之前版本安装有所不同。
http://blog.tidalware.com/2009/08/building-ogre-with-visual-studio/
此教程说得很详细了。
Prerequisites
Download and install the latest DirectX9 SDK: http://msdn.microsoft.com/en-us/directx

Download and install CMake from http://www.cmake.org/cmake/resources/software.html
Download the latest dependencies package: http://sourceforge.net/projects/ogre/files/ (since this post was last updated)
[TRUNK] Checkout ogre from SVN: https://ogre.svn.sourceforge.net/svnroot/ogre/trunk/
[1.7 STABLE] Checkout ogre from SVN: https://svn.ogre3d.org/svnroot/ogre/branches/v1-7 OR download a source package from: http://www.ogre3d.org/download/source
总的来说需要:directx, cmake, 1.7.0源码,dependencies package,当然还有vs2005 sp1。
Building Ogre
You need to build the dependencies. Extract the Dependencies folder from the zip into the root directory (/trunk/Dependencies/). Go to Dependencies/src and open OgreDependencies.VS2008.sln. Right click the solution and click Build Solution, which will build every project. Do this for both Release and Debug.
Open CMake. “Where is the source code” should point to the root directory, and “Where to build the binaries” should point to a sub folder in the root directory. For example, you can create a folder named VCBuild.
Click Configure. Choose the compiler you are building for.
A list of options in red will appear. Configure it how you choose. I disable BUILD_PLUGIN_BSP and BUILD_RENDERSYSTEM_D3D10 since they are unnecessary for me.
[OPTIONAL] If you have boost built and require threading, set the BOOST_ROOT value to the root of your boost directory (e.g. “C:/boost_1_39″). Subsequent boost variables should automatically be populated. (If this is an environment variable, it should automatically detect it.) Don’t forget to set CONFIG_THREADS to 1 or 2 depending on your requirements.
Click configure once again.
The options should turn grey. Click OK.
Open OGRE.sln in your build directory.
Right click the ALL_BUILD project and click Build. Do this for both Release and Debug.
Right click the INSTALL project and click Build. Do this for both Release and Debug.
You’re done! Make sure you direct any projects using Ogre to the generated sdk folder in your build directory.
配置 http://blog.tidalware.com/2009/06/ogre-and-visual-studio-beginners-faq/
Open up Visual Studio C++.
File -> New -> Project…
Make sure the project type is “Win32″ and the templated “Win32 Console Application” is highlighted.
Enter the name and location of your project in the respective fields. I named mine “OgreTestProject”.
An application wizard will pop up. Click “Application Settings” and check “Empty project” then click finish.
Right click the “Source Files” folder in the Solution Explorer. Then Add -> New Item…
Select “C++ File (.cpp)” and enter “main” in the Name field. Add “\src” to the end of the Location field value.
Go to Project -> Properties.
In the top left hand corner of the Properties window change the Configuration to “All Configurations”.
Select General in the Configuration Properties. Copy the “Output Directory”. Select Debugging and paste this in the “Working Directory” field. (这是整个guide里面唯一觉得有些疑惑的地方,工作目录的选择,很多人的做法是把sdk中bin目录cp到工程目录下,再把工作目录设置成../bin/debug或者release)
Expand C/C++ -> General
In the “Additional Include Directories” click the “…” button and a dialog should pop up. Again, click the “…” button, navigate to YourOgreRoot/YourBuildDir/sdk/include and select the subfolder “OGRE”. Click ok twice.
Change the Configuration drop-down in the top left to “Debug”
Expand Linker -> General
In the “Additional Library Directories” navigate to YourOgreRoot/YourBuildDir/sdk/lib and select the subfolder “Debug”.
Go to Linker -> Input
In “Additional Dependencies” add “OgreMain_d.lib”.
Change the Configuration drop-down in the top left to “Release”
Go to Linker -> General
In the “Additional Library Directories” navigate to YourOgreRoot/YourBuildDir/sdk/lib and select the subfolder “Release”.
Go to Linker -> Input
In “Additional Dependencies” add “OgreMain.lib”.
Click ok.
Enter the following code in main.cpp:


#include <Ogre.h>

int main(int argc, char* argv[])
{
    Ogre::Root* root = new Ogre::Root("plugins.cfg", "ogre.cfg", "Ogre.log");
    delete root;
    return 0;
}


In the toolbar at the top next to the green arrow is a drop-down list. Make sure this is set to “Debug”.
Click the green arrow.
Oh no! You got “This application failed to start because OgreMain_d.dll was not found. Re-installing the application may fix this problem”.
Navigate to the location of your Ogre SDK and head to the bin folder, then the debug folder. Copy “OgreMain_d.dll”.
Go to your project directory, there should be a new folder named “Debug” paste “OgreMain_d.dll” in there.
Press the green arrow in Visual Studio again.
Congratulations! You just ran your first Ogre application!
================== 尝试了2天左右,放弃又继续,继续又放弃
最后分别在笔记本和台式上分别装了OGRE1.6.5和1.7.0(都是在vs2005,也就是vc8.0),用http://www.ogre3d.cn/wiki/这里面的代码测试的,都通过了。但是仍然不敢说完全掌握怎么安装和配置OGRE,真恐怖的东西。
1,很多编译错误只是没配置好,也就是说lib或dll没有指对位置。参照上面的guide配置(1.7.0和1.6.5基本都适用)。一直没时间好好整理一下配置vs的基本知识,先这样吧。
2,在尝试basic tutorial 1的时候出现5个左右的链接错误,里面和OIS相关。因为没关联到OIS.lib或OIS_d.lib。
3,后来执行的时候还是出现古怪的错误,说不能打开../../media。这是因为resouces.cfg中采用了相对路径,全部改成绝对路径。
4,在sdk搜搜需要的文件。
备忘,暂此。
0 0
原创粉丝点击