History: Codeblocks and MinGW
Preview of version: 4
- «
- »
{IMG(src="img/wiki_up/CBsplash.jpg")}<font size="+2">Using Ogre with Code::Blocks + MinGW C++ Toolbox</font>
<br style="clear: both;">
FORCETOC
Download the SDK
Ogre 1.4.0 SDK for Code::Blocks + MingW
Ogre 1.2.5 SDK for Code::Blocks + MingW
MingW will statically link libstdc++ (the library portion, not the STL) to each build ie each dll or exe. This creates a problem when passing strings and any stream types across dll's. Because the static linking has each copy of libstdc++ managing its own strings and streams, passing a string/stream to another dll and then having it modified there will trash memory. Ogre has several dll's and does pass strings and streams around. Do a debug build of Ogre with libstdc++ and then run in gdb and you find out quickly that a crash occurs in OgrePlatform_d.dll after the config window closes when it tries to modify/deallocate a string passed to it from OgreMain.dll.
A release build using libstdc++ "seems" to run fine for simple Ogre demos but if you start passing a lot of Ogre strings across dll's in a more complicated app, the app starts to misbehave after a while and crashes occur.
libstdc++ was rebuilt with the configure option --enable-fully-dynamic-string so that strings are dynamically allocated using the RTL and can be passed across the dll boundry.
wchar, wstring and wide streams for unicode support don't work in the standard pre-built libstdc++ that comes with g++ 3.4.5. libstdc++ was rebuilt with wchar, wstring and wide stream to support wide strings so that Ogre 1.4.x could be built.
The Ogre SDK comes with:
- all the Ogre modules built for you ie the dll's and static archives
- the Ogre manual in HTML format
- API reference in the form of a windows compiled help (.chm)
- All header files (*.h) for the libs/dll are included
- Source code and project files for 30 demos that you can compile and run as a confidence test of the SDK installation and to see what Ogre can do.
- All media resources required for demos
- Material Scripts + shader programs
- Compositor Scripts
- Particle Scripts
- Meshes + Animations
- Textures
What you need to provide that is not supplied in the SDK
The SDK was built and tested with the following:
MinGW C++ Toolbox
Download the MinGW C++ Toolbox provided on the Ogre SF files site. MinGW must be setup before running Code::Blocks for the first time to make detection of MinGW go smoothly.
Download the installer package which will install the following in your mingw directory ie c:\mingw.
- gcc-core-3.4.5-20060117-1
- gcc-g++-3.4.5-20060117-1 with modified libstdc++ with dynamic string and wide string support (online Manual)
- w32api-3.8
- binutils-2.17.50-20070129-1 (online Manual)
- mingw-runtime-3.11
- gdb-6.3-2.exe (online Manual)
- DrMingw (online manual)
MinGW Toolbox Install Guide
Read the MinGW Toolbox Install Guide before running the toolbox installer.
Code::Blocks
- �49514�Code::Blocks�49515� - Release 8.02
There is an official release of Code::Blocks as of February 2008. This supersedes the previous release candidate, which even the
Code::Blocks team didn't recommend anyway. For the longest time, to use Code::Blocks you had to have a nightly build of the development trunk,
certainly so if you wanted to compile OGRE. If you have used release candidate RC2 or one of the pre-release nghtly builds, do get the
new official release instead! In any case, the build files supplied with OGRE will not work with the old release candidate.
Check Code::Blocks + MinGW installation
Make sure that Code::Blocks found your MinGW C++ Toolbox installation by following these instructions here: Code Blocks Compiler Setup
DirectX 9.0c August 2006 edition
- <font size="+1">Download the SDK</font>. You will need the DirectX SDK if you plan to build and run in debug mode when using Direct3D9 Rendering mode. If you plan on building Ogre from source at a later date then you will need the DirectX SDK also. Note that this SDK doesnt work on Windows 2000 or less.
Note: You do not need to download the dependencies package for Code::Blocks+MingW, everything you need is included in the SDK.
The Ogre Core libraries and plugins:
In the settings menu select Compiler and Debugger to setup the directories.
Setup the include directories for the compiler.
Setup the lib directories for the linker. Note that DirectX SDK lib is not used. The import libs in the Ogre dependencies will be used instead since MingW cannot link directly to the libs provided in the DirectX SDK.
Include directory for windows resource compiler.
To build Ogre in Code::Blocks, open the Ogre.workspace file. If you have installed or are using Code::Blocks + MinGW + STLPort, open the Ogre_stlp.workspace file.
In the build menu select Build Workspace. This will build the debug and release targets of all projects listed in the workspace manager window.
The build process will take about 30 minutes on a AMD Athlon XP 2000+ with 512Megs if all projects are built.
You will (hopefully) find the newly build sample demos under:
- ogrenew\Samples\Common\bin\Debug
- ogrenew\Samples\Common\bin\Release
<u>Building Ogre Core DLLs</u>
If you don't want to build the samples choose Save Workspace as... under the file menu, enter OgreCore_stlp.workspace for the file name and save. Next, close the samples and projects in the workspace that you don't want, and save again. You can use the OgreCore_stlp workspace to re-build Ogre each time you update from CVS.
Here is an example of the minimum Ogre Core DLLs that must be built for the SDK. This assumes that you are utilizing the BSP and Octree scenemanagers, both DirectX and OpenGL renderers, CG shaders, and CEGUI.
Note: Code::Blocks builds the projects in the order listed in the Manager window. Dependencies have been set up to insure that if you decide to build a demo before the core libraries, the core library projects will be built first.