Ogre3D and NetBeans on Windows

I just started a project I was waiting to start for so long. Before writing design documents, planning classes and stuff, I started setting up the development environment.

I’m working on Windows XP with MinGW, I’m used to C/C++ development  in GNU/Linux (vim, make, …) but in the last years I coded a lot in Java using NetBeans IDE. So I wanted to setup NetBeans in order to take advantage from code completion and syntax check.

When I stumbled on Ogre SDK support in Eclipse I thought “I’m done”. I was wrong.

What doesn’t work is the path system for includes and libraries. Using ${OGRE_HOME} will lead to a “Build failed” message.

Include directories and libraries path must be in a slash form, i.e. c:/OgreSDK/include;c:/OgreSDK/samples/include

I changed some other setting, here is the full working setup (assuming Ogre installed in C:\OgreSDK):

  • C++ Compiler
    • Include directories: c:/OgreSDK/include;c:/OgreSDK/samples/include
    • Preprocessor definitions:
      • WIN32
      • _WINDOWS
      • _DEBUG
    • Additional options (add -v if you need more control): -fmessage-length=0 -mthreads -fexceptions -fident
  • Linker
    • Additional library directories: c:/OgreSDK/bin/debug
    • Libraries: (use add library button)
      • OgreMain_d
      • OIS_d
    • Additional options: --enable-auto-image-base --add-stdcall-alias

If you want to run your project directly from NetBeans, add this setting in Linker->Runtime search directories: C:/OgreSDK/bin/debug;C:/Programs/Microsoft DirectX SDK (August 2006)/Developer Runtime/x86

Same story for “release” build, just change _DEBUG with NDEBUG, use normal libraries instead of debug ones (throw away the _d from library name) and use “release” instead of “debug” path for libraries.

(assuming that you need DirectX and you installed it in that directory)

Be sure to avoid adding extra spaces in paths and settings.

Creative Commons License
Content is released under Creative Commons License.

Advertisements

6 comments on “Ogre3D and NetBeans on Windows

  1. gwy says:

    Thanks a lot! You saved my day. 🙂

  2. jks says:

    Hey.
    I’ve got a problem with that mather. The sample source from this website:
    http://www.ogre3d.org/forums/viewtopic.php?p=199513&sid=ce193664e1d3d7c4af509e6f4e2718c6
    and I tried to configiure the properties by Your and advices from that website.
    With both the code doesn’t want to compile

    • Giuseppe says:

      What is the error message? I just used the code from that forum thread and it works without troubles.
      Take a look at the output window and see if the command executed by NetBeans looks like this one
      g++.exe -fmessage-length=0 -mthreads -fexceptions -fident -c -g -Wall -DWIN32 -D_WINDOWS -D_DEBUG -Ih -I/c/OgreSDK/include -I/c/OgreSDK/include/CEGUI -I/c/OgreSDK/samples/include -o build/Debug/MinGW-Windows/src/newfile.o src/newfile.cpp
      (where src/newfile.cpp is the name of my test file).

  3. jks says:

    Here is output from my console
    http://wklej.org/id/286042/

    • Giuseppe says:

      I see two problems:

      1. you have to add the definitions (DWIN32, _DEBUG and _WINDOWS) one at time using the dialog in Netbeans: in project properties -> Build -> C++ compiler -> Preprocessor definitions click the “…” button and add the three strings one at time
      2. the actual error is this command mkdir -p D:\Infomratyka\GameDev\oogre sdk\OgreSDK\bin: this line creates 2 directories, one named D:\Infomratyka\GameDev\oogre and the other sdk\OgreSDK\bin, to create a directory with spaces in the path you have to surround it with double quotes; try using a path without spaces in it (i.e. move your project to something like D:\Infomratyka\GameDev\oogre_sdk\OgreSDK\)

      I hope this helps.

      Edit: sorry for the poor formatting, this blog theme doesn’t like ordered lists very much.

  4. jks says:

    You are genius man ^^
    THANKS!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s