DevCPP building         Using DevCpp to build Ogre from source

%prevogre%

This is unsupported, deprecated and (most probably) injurious to your health.

Use another development environment - Visual Studio, Code::Blocks or Eclipse.


1) Get Dev-C++ 4.9.9.1 (note the version number) we need to use the older beta (4.9.9.1) because of an MinGW issue (the new beta has MinGW 3.4.x and we need 3.3.1 for this DevPak to work right), you must get it from here (http://prdownloads.sourceforge.net/dev-cpp/devcpp4991setup.exe), if you don't already have it.

2) Get the Ogre DevPak and extra info from this thread (http://www.ogre3d.org/phpBB2/viewtopic.php?t=8788) on the forums, which I am going to use as an unofficial Dev-C++ support thread, or alternatively from the SDK repository (http://www.ogre3d.org/index.php?option=com_remository&Itemid=57&func=fileinfo&filecatid=24&parent=category).

3) Install Dev-C++ 4.9.9.1 to anywhere you wish (I prefer c:\gcc).

4) After installing, double click on the DevPak, and follow the instructions to install.

5) Go to Tools -> Compiler Options -> Directories, and add "<DevCPP install dir>\lib\OGRE" to "Libaries" and "<DevCPP install dir>\include\OGRE" to "C++ Includes"

6) Go to \Examples\OGRE and double click on Terrain.cpp (it should load in Dev-C++), click on Tools -> Compiler Options and check the "Add these commands to the linker command line" box -> add "-lOgreMain" without the quotes in the form.

7) Execute -> Compile

Done (yet!??).

8) Of course, to run the examples, you need the media files, so go to Windows Demos (http://www.ogre3d.org/index.php?option=com_remository&Itemid=57&func=fileinfo&filecatid=6&parent=category) and replace the .dll's with those in \bin\OGRE, and the executables for the ones you've freshly compiled.

Clarification: Plugin_*.dlls and RenderSystem_*.dlls go to demo_directory\plugins all others go to the demo_directory. Also, you need to edit Plugins.cfg and add "#" before the line "Plugin=RenderSystem_Direct3D7".

Now isn't that A LOT easier? Two steps really. :-)

An additional note on the Dev-C++ IDE: you will probably want to update the Dev-C++ IDE to 4.9.9.2, because it includes a lot of bug fixes, to do this you simply have to go to Tools -> Check for Updates/Packages... and get Dev-C++ 4.9.9.2, you'll have to close Dev-C++ after it downloads and installs (you'll be prompted to do this).

A note on compiling the demos (and in general), if (when) you get linker errors, try adding one of these two things to the Tools -> Compiler Options -> "Add the following commands when calling compiler" form:

If you get an error describing "multiple definitions" use "-Wl -allow-multiple-definition"

If you get an "auto import failure" error, use "-Wl -enable-runtime-pseudo-reloc"

(This may need to be added into Tools -> Compiler Options -> "Add these commands to the linker command line" rather than compiler commands, so you will have "-lOgreMain -Wl -enable-runtime-pseudo-reloc" without the quotes)

Lastly, if your executables crash on start, and you get some silly error about the MSVCRT runtime (I can't remember the error exactly, but Ogre shuts down before creating a render window), you probably downloaded Dev-C++ 4.9.9.2, with MinGW 3.4.x, which won't work with this DevPak (I tried to no avail to get Ogre to work with MinGW 3.4.x, btw, so this is a necessary step for the time being) and see, you could've saved yourself a lot of trouble if ya read this! :-)

With all of these notes in place you should be able to compile Ogre stuff without any problems. The only thing left is to point out that GCC doesn't strip by default (so your executables are going to be about twice as big as they could be), you can change this in the compiler options, so look around. Feel free to discuss any problems you're having on the forums!

BTW, I'd like to thank :wumpus: for providing us with a Cygwin compatable build process, dermont for helping with these optional commands to GCC so that MinGW doesn't bork out, and Sinbad for hosting the DevPak for us, and creating Ogre in the first place.

Total size of Ogre + Dev-C++? 15 megs. Total size of any VC++ install plus Ogre? Over several hundred megs. Open source rules, heheh.