Eclipse MingW STLPort         How to setup the Eclipse environment for use with MinGW/STLPort and Ogre

%prevogre%

Tip_icon.png Warning: This guide is deprecated - use this guide instead: Eclipse MinGW

Ogre3D SDK support in Eclipse

Install MingW

For the sake of organization and simplicity, I will use the c:\devel as our root dir. Everything will go in there.

MingW Core

Get these:


Unzip all of them in c:\devel\mingw

MSYS installation

Download:


Install it to c:\devel\msys (not c:\devel\msys\1.0)
Run post install and point the mingw installation to the right place (in our case: c:\devel\mingw)

Note: You need msys for some system funcionalities (such as rm).

Configuration

Put the BIN folders in your path (c:\devel\mingw\bin;c:\devel\msys\bin)

Right-Click My Computer > Properties |Advanced| [Environmental Variables], Click New
Variable name: Path
Variable value: c:\devel\mingw\bin;c:\devel\msys\bin

Checking

  • gcc -v


You should get something like

gcc version 3.4.2 (mingw-special)
  • rm --version

You should get something like

rm (fileutils) 4.1

Install OgreSDK

Download:


Install it to c:\devel\ogre\OgreSDK (useful if you want to have the source available for reference in c:\devel\ogre\ogrenew)

Install Eclipse

The Core

  • Download Eclipse
  • Extract It
  • Run Eclipse.exe (Set the workspace to anywhere you like. I like to use c:\devel\workspace)

C/C++ Developement Tools Plugin

Install the C/C++ Development Tools Plugin

  • Click Help > Software Updates > Find and Install
  • Select the "Search for new features to install" option and click Next
  • Check "Callisto Discovery Site" and click Finish
  • Expand "Callisto Discovery Site" and Check "C/C++ Development Tools"
  • Click through the Dialogs to Install and Click Yes when asked whether to reset the workspace

OgreSDK Configuration

Go to Window->Preferences->C/C++->PathEntry Variables
Click NEW

Put this info:

  • Name: OgreSDK
  • Location: C:\devel\ogre\OgreSDK

Other Configuration Options

  • Emacs Bindings: If you like the emacs style bindings go to Windows > Preferences, General > Keys > |Modify|, Switch the Scheme Pulldown to Emacs
  • Disable Auto-Build: Click Project > Uncheck Build Automatically

Creating a New Project

  • File->New->Project
  • C++->Managed make project
  • Set a name for your project
  • Right-Click your Project in the Left Pane and Click Properties
  • Click C/C++ Build on the Left

Build Configuration

  • Set the Configuration Pull-Down to Release or Debug and enter the options from the table below:

GCC C++ Compiler

Preprocessor
Add the Following Defined Symbols
* _STLP_NO_CUSTOM_IO

If your app does not define any custom IO templates then this define will speed up compiles.
* _STLP_USE_DYNAMIC_LIB
This ensures that the DLL version of STLPort is used.
* WIN32%%%* _WINDOWS
ReleaseDebug
NDEBUG_DEBUG
_STLP_DEBUG
Directories
Add the Following Directories
Important: Keep the quotes when entering directories.
"${OGRE_HOME}\stlport\stlport"
VERY IMPORTANT: The stlport include directory has to be first in the include directories. If it is not then headers used for libstdc++ could get included which will cause conflicts with stlport during the link stage. You will most likely get undefined reference error messages with member methods saying they require std::string (method parameters). You should never see std:: in an error message and if you do then it means that the STLPort headers were not found and libstdc++ headers were used instead. If you do end up in this scenerio, after you correct the directory problem you must do a rebuild so that everything gets recompiled with the proper headers. Selecting build won't do it since CB will just attempt to do the link stage again since it doesn't detect any changes in the source and will fail again.
"${OGRE_HOME}\include"
Your project include directories
Miscellaneous
Change the Other Flags line to the following:
-c -fmessage-length=0 -mthreads -fexceptions -fident

GCC C++ Linker

Libraries
Add the Following to "Libraries -l"
Your project dll's or static libs (.a)
ReleaseDebug
OgreMain
This is the name of the release build of OgreMain dll.
stlport.5.0
This must be the last entry.
OgreMain_d
This is the name of the debug build of OgreMain dll.
stlportstlg.5.0
This must be the last entry.
Add the Following to "Library Search Path -L"
ReleaseDebug
"${OGRE_HOME}\bin\release""${OGRE_HOME}\bin\debug"
Miscellaneous
Add the Following to "Other Options (-Xlinker)"
--enable-auto-image-base
--add-stdcall-alias

Notes

  • Eclipse will build with the Configuration you leave selected. You can also change this under Project > Active Build Configuration

  • OGRE_HOME is a pre-defined environment variable setup by the SDK installer. OGRE_HOME points to the directory where the SDK is installed. You can use ${OGRE_HOME} within your build options when setting up paths to specific directories with the SDK that you will need to access.

  • WARNING: Do not mix dll and static object builds using different STL implementations. Here is an example: You build a dll using stdlibc++ but your exe is built using STLPort. Everything that is c++ must be built using STLPort. This does not apply to C static libs and dll's.

Basic Tutorial 1

We can test our project with Basic Tutorial 1

  • Make a New C++ Source File, name it something like Tutorial1.cpp
  • Copy the Code from Basic Tutorial 1 into the file
  • We need to tell the compiler where ExampleApplication.h is.
    • Under the Project Properties
    • C/C++ Build > Directories > Include Paths, Add:
    • "${OGRE_HOME}\samples\include"
  • Click Project > Build All



Required Files

Ogre Files

If you try running your program it will complain about missing DLLs.

  • Copy all the files in c:\Devel\Ogre\OgreSDK\bin\release to your Release Build Directory in the Workspace (Where the .exe is), Do the same for the Debug directories.




If you try running now Ogre will give an error about not finding the media directory.

  • Copy the c:\Devel\Ogre\OgreSDK\media Folder to your Workspace directory, (2 directories below your .exe)

Note: The resources.cfg file tells Ogre where to find these media files. If you wish to put this folder somewhere else you need to edit this file.



Note: Cleaning your project will remove all these files, I'm not sure how to change this behavior

DirectX

If you don't have the DirectX Runtime installed you will get an error about a missing d3dx9_29.dll

When you try a debug build it will complain about a missing d3dx9d_29.dll file.

  • Ogre 1.2.2 (8/10/2006) requires the 29 DLLs.


End-Users just need the Latest DirectX Runtime (Supplies the d3dx9_##.dll file needed for your Release build):


I believe August may come with all d3dx9_##.dll's from 24-30, so you don't need to worry about getting the older version, I haven't confirmed this though. There's no way to uninstall DirectX so I can't determine whether a new install comes with all the versions.

To Debug you need the DirectX SDK (Supplies the d3dx9d_##.dll file needed for your Debug build):

Note: The SDKs come with only one d3dx9d_##.dll file. April, June, and August are 30. February is 29.

Eclipse Ogre Plugin - No Longer Available

Once upon a time there was an Eclipse Ogre Plugin that would setup the build for you, here's the old text:

Get the Eclipse plugin for Ogre here: ogre.toolchain.zip

Unzip it inside eclipse directory (c:\devel\eclipse)

UPDATE 6/22/2006 - This link is broken. There's no good way to continue through this procedure without it, but it's been suggested in the forums (http://www.ogre3d.org/phpBB2/viewtopic.php?t=21906) that you can use the configuration information that has been supplied for Code::Blocks to setup Eclipse and things should work. It would be nice if someone could share this file, though.

UPDATE 8/10/2006 - I've added this configuration information to this page.