Building Ogre with Visual Studio
Posted by Daniel on August 29th, 2009 | 25 Comments »
Changelog:
6th January 2010
- Building the latest 1.7 dependencies package.
- It’s now a generic Building Ogre with Visual Studio guide, since there’s no longer a compelling reason to build from trunk.
This is my “hold-your-hand” guide to building the latest Ogre with Visual Studio C++, trunk or stable.
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, that would be: ogre-dependencies-vc++ -> 1.7 -> OgreDependencies_MSVC_20100106.zip)
- [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
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.
FAQ
What happened to CEGUI?
From 1.7, CEGUI is no longer part of Ogre. You should now treat it as a separate library. For instructions, refer to Building CEGUI.
What do I do next?
If you’ve not familiar with setting up an Ogre application, see my Ogre and Visual Studio Beginners FAQ and follow the walkthrough.
Let me know if you have problems with any of the steps, suggestions etc.




25 Responses
Thanks thanks thanks thanks thanks! everything worked perfect! took me some hours tho, (compiling Ogre was a pain, the samples at least)
but now i updated my whole project and it’s running fine!
if i want to update my Ogre Engine, i just gotta go to the VS project and build install again and transfer the files from the install directory to the Ogre directory i use, is that correct?
nevertheless, thanks a lot for the guide, followed it step after step and it worked!
Oh, one small thing should be mentioned.: deactivating BUILD_RENDERSYSTEM_D3D10 is mandatory if you dont want your builds to fail – else i guess you need to install the DirectX10 SDK, too!
Hi Lukas,
You’re welcome, glad it helped.
By update Ogre engine, do you mean build the latest SVN changes? If so, just update the folder with SVN, open up OGRE.sln, right click ALL_BUILD and click Build (NOT Rebuild), and it should compile only the recent changes. Then yeah, just copy the files again from the sdk folder in your build directory. So that’s libraries, DLLs and include files.
As for DX10, the DirectX SDK contains both DX9 and DX10 ;)
Very great this tutorial.
Thank you to save my time and the time of so many others.
We should transfer it to the wiki or link this site.
Can I have the permission to link it or to post it on the wiki?
Or do you want to do it yourself?
Good job :)
Greetings
Andy
Hi Andy,
Apologies for taking so long approving your comment, the spam detection is too sensitive :P
You can link to it, sure. Perhaps it should be added to the wiki, I wrote it here first to get it perfected and gain feedback. Looks promising so far!
Got a few more bits to add, then I’ll see about wikifying it.
Cheers.
Add in Step 2, that for example if you use CEGUI, and you want to use the latest version you will also have to replace the CEGUI files in that dependency folder with those from the CEGUI SDK u want to use, or else you’ll have nasty entry point errors like i did,… took me 2 hours to find the reason for those errors, hell, and now i have to rebuild the whole thing once more which wil ltake another 4-5 hours for waiting :((
forget my last reply – CEGUI aint directly supported by Ogre anymore, so this didnt help and i m still stuck with problems about this…
Hi Lukas,
In that case, CEGUI should be treated as a separate library entirely. So you’ll have to rely on support in the CEGUI forums if it’s not working.
Since it’s no longer part of Ogre, perhaps I should add a note for those upgrading from <1.6.
I found this thread about CEGUI and 1.7 which may help:
Well, Daniel,.. I’m the one who started that thread after those issues I had :D — so yea, i know about the thread — however i haven’t yet been able to do what jacmoe suggested there yet due to time and motivation but once i will have done that and have goten my project to run with the latest dependencies, I will possibly make a tutorial in the wiki for this, so other people won’t be losing a lot of hours on this like I did :(
Thanks for the link anyways :D
Oh, that was your thread? lol
Well, hopefully it will help others :P
Let me know if you get it working.
Got it working!
I also created this step by step guide, hope i didnt miss anything in it:
http://www.ogre3d.org/wiki/index.php/Building_CEGUI
also put a link to this site in there
excuse me,I did all the things you said and there is no erros till the end,but there is no package “sdk” generated after I buid the install project.
give me a help please, thank you.
@Lukas – Good work, hopefully it’s useful to others :)
@jie – You sure? “sdk” is a folder btw. At step 6, did you create a sub directory (VCBuild)? It should be in there…
thank you for your response.
The install project logs are all about:
– Up-to-date: C:/Program Files/OGRE/lib/Debug/opt/Plugin_OctreeZone_d.lib
– Up-to-date: C:/Program Files/OGRE/bin/Debug/Plugin_OctreeZone_d.dll
……
at the end:
INSTALL – 0 error?0 warning
there’s no folder “sdk” generated according to the logs.and I also can’t find it in the path ogre/VCBuild.
could you give me your email,I’ll send my screen-print to you.
it seems the install project directly install the ogre to C:\Program Files\OGRE after I build it.
I rebuild it again,but it’s the same.
there’s no folder “sdk” generated.all the lib file and .h file was coped to C:\Program Files\OGRE,but there’s no “sample” folder generated, if I run sdk.exe “sample” folder will be installed
Been trying to get 1.7 setup for a while, this helped a lot.
Thanks :)
Great step-by-step. Thanks a lot!!! For those of you having trouble with CMake complaining about the MS Visual Studio C compiler (”cl”) not being able to change directory, you need to add “C:\Windows\system32″ to your path. This took me several hours to troubleshoot and there is not much help on the web on this issue. The general error received is:
The C compiler “C:/Program Files/Microsoft Visual Studio
9.0/VC/bin/cl.exe” is not able to compile a simple test program.
It fails with the following output:
Change Dir: C://CMakeFiles/CMakeTmp
You can also try to compile Ogre 1.7 trunk in 1 step:
Get OgreKit.zip from http://gamekit.googlecode.com and open OgreKit.sln
i can’t compile the dependencies, freetype et Cg don’t compile, if i open the project separatly, it works but not with the ogre.VS2008.sln.
any ideas ?
i have visual studio 2008 from msdnaa, sources from SVN 1.7 the dependencies named : OgreDependencies_MSVC_20100106.zip
what did i do wrong ?
ul.Duc, thanks for your help, i try that for 5 days now non stop !
now it’s ok, i just used the precompiled SDK but i works fine with the project configuration.
thank you very much, i can now begin with ogre.
ul.Duc
Hey thanks, I got it to compile okay. Is there a way I can run the samples? When I try and run one in the compiler it looks for a .exe.
Also, I built it with the Trunk, if that helps any.
@Aaron: Open your eyes wide and look into the bin/release folder or where your compiled executables went:)
— SampleBrowser.exe —
( or the SampleBrowser project )
is used to start all the samples. The samples alone are implemented as library.
Greate Blog !!!!!
Otherwise installing and building Ogre is a nightmare.