Setting up an OGRE Eclipse project on Windows.


Software Notes

  1. Get Eclipse with CDT: You can find directions at: http://max.berger.name/howto/cdt/cdt.jsp. The next two steps have some notes concerning this setup. You will need Java to run eclipse, so you may want to download that as well.

  2. You will need MinGW and MSYS. MinGW has an online installer that lets you download both the c++ compiler and msys at once.

  3. Make sure you following the instructions concerning the environment variables althoug your paths may be different (the MSYS directory is in the MinGW directory).

  4. Download the OGRE SDK. This executable will extract itself wherever you run it. Once extract it move it to some easy to remember directory e.g C:\GameStuff\OgreSDK_mingw_v1-7-2. This directory should contain a bin, lib, include directories among other things. For the rest of these instructions I will refer to this directory as C:\path\to\ogre or /path/to/ogre.

  5. Download CEGUI. This is an archive which should be unzipped. Again, I recommend C:\GameStuff\CEGUI-SDK-0.7.5-mingw. This directory should contain bin and lib directories among other things. For the rest of these instructions I will refer to it as C:\path\to\cegui or /path/to/cegui

  6. Add the C:\path\to\ogre\bin\Release and C:\path\to\cegui\bin to your Computer's path. See the link instep one for instructions on setting your path variables.


Creating a project

  1. Create a new empty C++ project in Eclipse. Use the MinGW Tool Chain. Give it a name and hit the "Next" button.

  2. Click the "Advanced Settings..."

  3. Click the "C/C++ Build" drop-down on the left.

  4. Click Environment

  5. At the top of the "Tool Settings" tab, select "[All Configurations]" in "Configuration:". You may need to scroll up, to see it.

  6. Add two environment variables with the "Add..." button.

    NAME=OGRE_HOME      VALUE=C:\path\to\ogre
    NAME=CEGUI_HOME     VALUE=C:\path\to\cegui
    
    Be sure you replace the paths with the actual path where Ogre and CEGUI reside.

  7. Click "Settings" under "C/C++ Build" on the left side of the window.

  8. In the "Tool Settings" tab, click "Includes" under "GCC C++ Compiler"

  9. Click the Add button icon (a document with a green plus sign on the right).

  10. You will need to add the directories where the include files are for OGRE, CEGUI, OIS and boost. You can type exactly what appears below. Eclipse will use the variabl ${OGRE_HOME} here.

    ${OGRE_HOME}\include\OGRE
    ${OGRE_HOME}\include\OIS
    ${OGRE_HOME}\boost_1_44
    

  11. Click "Libraries" under "GCC C++ Linker". In the section "Libraries (-l)" add the following names:

    OgreMain
    OIS
    OgreProperty
    OgrePaging
    OgreRTShaderSystem
    OgreTerrain
    CEGUIBase
    CEGUIOgreRenderer
    
  12. Add the library paths in the "Library search path (-L)" area.

    ${OGRE_HOME}\bin\Release
    ${CEGUI_HOME}\bin
    
  13. Click "Ok".

  14. Click "Finish".

  15. Create a src directory inside your project directory.

  16. Copy all of the .cfg files from C:\path\to\ogre\bin\Release into your projects main directory.

  17. In eclipse, right click on your new project and select "Refresh".

  18. Double click "resources.cfg" and change all of the "../.." to "/path/to/ogre" without quotes. Notice we changed the direction of the slashes.

  19. Save "resources.cfg" You may need to edit the paths in the configuration files for your computer.

  20. Double click "plugins.cfg".

  21. You might need to turn off the Direct3D renderer if the version on your system is not the EXACT version used to build Ogre. Put a # in front of the line "Plugin=RenderSystem_Direct3D9". Once you get it building with OpenGL, try uncommenting the line and see if it works. You can also build Ogre's plugins yourself so it matched your system, but I'm not going in to that detail here.

  22. Download the four Tutorial files in http://cs.gettysburg.edu/~cpresser/cs391/base/ to your src directory.

  23. In eclipse, right click on your new project and select "Refresh". You are now ready to edit your OGRE project. Make sure you build it (Hammer Icon) once before attempting to run it.

  24. The next time you want to set up a project, right click on this project and Copy it. Paste it, give the new one a different name, delete the files in src and run "Clean..." from the "Project" menu for the new project. You won't have to enter in all of the new settings again.


Problems

The program does not compile

Make sure all of your environment variables, paths, libraries and settings were typed correctly. Look at the outoput and try to figure out what is missing.

The program compiles, but terminates immediately when executed

I've notice this with 64 bit systems (64 bit Java, 64 bit eclipse, Windows 7). Eclipse seems to ignore the PATH variable, so we have to make sure the proper path is set for execution.
  1. Open your project properties (right click on the project and select "Properties..."

  2. In the left side of the window, select "Run/Debug Setting"

  3. Click the executable name and click the "Edit..." button.

  4. In the new window that pops up, click the "Environment" tab.

  5. Click the "New..." button.

  6. In the new environment variable dialog add:

    Name=PATH
    VALUE=C:\MinGW\bin;C:\path\to\ogre\bin\Release;C:\path\to\cegui\bin
    
    Replace the paths with the actual values for your installation. You cannot use OGRE_HOME or CEGUI_HOME variables here.

  7. Now try to run the program.