Codeblocks         Installing the Ogre SDK for Visual C++ Toolkit 2003 & Code::Blocks

%prevogre%

Tip_icon.png This is deprecated. Either use Codeblocks and MinGW or Codeblocks and MS Visual Studio

{DIV(class="Layout_box9")}{SPLIT(colsize=15%|85%)}Image ---

Installing the Ogre SDK for Visual C++ Toolkit 2003 & Code::Blocks

Use this guide to install the precompiled OGRE SDK for Visual C++ Toolkit 2003 & Code::Blocks. Once you have OGRE downloaded and setup, learn how to setup your first application.{DIV}

Original version by Ionstream

First off, let me tell you that this is a completely free method of using Ogre.

Being a cheapskate, I was looking around for free IDEs, and of course, found Dev-C++. It's pretty good, despite it's bugs, and worked... up until I wanted to use Ogre. There were no GCC Precompiled binaries (which is understandable, because there are many flavors of GCC), and the using GCC with Ogre tutorials were so complicated, that I might as well have just bought VC .NET (yes, I almost went there). Luckily, MS has released the Visual C++ 2003 toolkit (the free compilers), and IDE's were already in the making. One of these IDE's is CodeBlocks (www.codeblocks.org), of which I highly suggested donating to if you plan on using it. Setup for Ogre in Codeblocks is fairly simple, as I will explain here.

  1. Download the VC++ Toolkit and install it.
  2. Download the Platform SDK. You can also use internet explorer to install it automatically (recommended).
  3. Download the latest version of DirectX 9.0 SDK and install it.
    (The latest one you can find, without needing to go trough the "Validation Required" thing, at: http://download.microsoft.com/download/6/b/5/6b5f39d7-d8f4-4cbd-a272-3470ab6bcba1/dxsdk_feb2006.exe for Windows Vista and http://download.microsoft.com/download/c/d/1/cd1a1e58-c12b-4ea2-a818-41d3e8d7780f/dxsdk_oct2005.exe for Windows XP and 2003 Server
    Windows 2000 and older is no longer supported)
  4. Download the latest CodeBlocks "without compiler" and install it.
  5. The first time you install CodeBlocks, you will be shown a list of compilers. Select Microsoft Visual C++ Toolkit, and click Set As Default.
    Press OK.
  6. This step only needs to be performed the first time you install Code::Blocks. Go to Settings->Compiler in the menu. Click the "Directories" tab and add the the following directories to the compiler tab (changing to account for where you installed the packages):
C:\OgreSDK\Include
C:\Program Files\Microsoft Visual C++ Toolkit 2003\Include
C:\Program Files\Microsoft Platform SDK\Include
C:\Program Files\Microsft Directx 9.0 SDK (<month> <year>)\Include

In the Directories/Linker tab add the following directories:

C:\OgreSDK\Lib
 C:\Program Files\Microsoft Visual C++ Toolkit 2003\Lib
 C:\Program Files\Microsoft Platform SDK\Lib
 C:\Program Files\Microsft Directx 9.0 SDK (<month> <year>)\Lib\X86


Finally, add the directory "C:\Program Files\Microsoft Platform SDK\bin" to the Resource Compiler tab. This isn't mandatory, but you need it if you ever want to compile ".rc" files.

  1. Download the latest Ogre 1.0.x SDK for Visual C++ .Net 2003 (7.1). This will work perfectly with the VC++ Toolkit! You do not need STLPort.
  2. Your Visual Studio or Dev-C++ project files can be imported via Project->Import-> (File Type). Or, you can make a new Win32 GUI application (Project->New Project...).
  3. To set the Ogre Directories, go to Project->Build Options, and click the "Directories" tab. Add

the Ogre "Include" directory to the "Compiler" directories, and add the Ogre "Lib" directory to the "Linker" tab.

  1. In the Compiler Options (first) tab, type "/EHsc" (without quotes) to the "More Options" box.
  2. In the Linker Options tab, add OgreMain.lib to the link libraries. Note that you don't need the full path, just "OgreMain.lib" will suffice. You may need to add user32.lib and gdi32.lib to the libraries if you imported a project. Press OK in all of the windows.
  3. You might want to check the properties of main.cpp if you get linking errors. In the general tab, make sure that it belongs to Release as well as Debug.
  4. Click the gear with the red arrow to compile and run your project. If all went well, you should be seeing the Ogre3D Engine Rendering Setup window!

Multithreaded Compiling

Ok, since the old version doesn't really works too good, I've found/gathered from others a much more effective solution:

You'll need 2 .lib files to use multithreaded compiling: msvcrt.lib and msvcprt.lib

The first one is easy to get: it can be found in the .NET SDK v1.1 (its probably in 2.0 too, but I haven't checked). The folder for that file is:
Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib
Don't forget that you must install the Redistributable package before installing the SDK!! The Redistributable .NET is used for running .NET applications, while the SDK provides the things to build .NET programs. Just go to the Microsoft' homepage and follow the links, or use my links (for the 2.0 versions):
http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe
for the redistributable, and
http://download.microsoft.com/download/c/4/b/c4b15d7d-6f37-4d5a-b9c6-8f07e7d46635/setup.exe
for the sdk
Remember to use a download manager, since these files are quite big (the sdk has 350MB)

The second file is a little harder to find, so I found them for you ;)
Go to:
http://root.cern.ch/root/Procedure/msvcprt.lib
http://root.cern.ch/root/Procedure/msvcprt.def
Get these files, and copy them to the same location (just for accesibility):
C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib

(or wherever you installed the msvc 2003 toolkit\lib)