Skip to main content

History: Compile OgreOde with Code::Blocks

Source of version: 4 (current)

Copy to clipboard
            [http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=7080|Discussion thread]

{img src="img/wiki_up/ODE_logo3.png" alt="" align="right"}

!!Introduction
Because I saw lots of people on the forums and had a hard time compiling OgreODE myself I decided to write a quick howto on compiling OgreOde with Code::Blocks 1.4.7 on Windows XP ''[[size_t error on Windows Vista? I'm going to check it]'' with a prebuilt OgreSDK Eihort 1.4.7 (though it should work similar with the sources) to go for the totally free way of 3D game programming :)
This howto is based on the current (April 27, 2008) versions of the software with OgreODE still trying to use the obsolete STLport. I hope it helps.

!!OgreOde_core and OgreOde_prefab
To compile the OgreOde_core and OgreOde_prefab:
* Install OgreSDKSetup1.4.7_CBMingW.exe
* Get ogreaddons\ogreode via [http://www.ogre3d.org/index.php?option=com_content&task=view&id=17&Itemid=141|SVN] and put it into $(OGRE_HOME)\ogreaddons\ogreode
* Download ode-0.9 binaries (ode-win32-0.9.zip) from the ODE website
* Unzip them to ogreaddons\ogreode and rename the resulting ode-0.9 folder to ode - you should now have a folder $(OGRE_HOME)\ogreaddons\ogreode\ode
* Open ogreaddons\ogreode\scripts\CodeBlocks\OgreOde_SDK.workspace, ignore the messages about the missing demos and the message about the missing ode_SDK.cbp - we don't need to compile that ourselves because we've got the pre-compiled release
* We need to throw out the STL Port. Change the following in the project's properties:

{CODE(wrap="1")} Linker settings -> Link libraries:
   Delete stlportstlg.5.0 or stlport.5.0

 Search directories -> Compiler:
   Delete $(OGRE_HOME)\stlport\stlport
   Add $(OGRE_HOME)\ogreaddons\ogreode\include

 Search directories -> Linker:
   Change ..\..\ode\lib\Release to ..\..\ode\lib\DebugDLL or ..\..\ode\lib\ReleaseDLL
{CODE}

(The changes are the same for prefab, just there's no need to change the linker's search directories)

* In $(OGRE_HOME)\include rename the ode folder to something else - we don't want that one to be used
* In OgreOdeGeometry.cpp [[line 903] change the line

{CODE(wrap="1")} dGeomTriMeshDataBuildSimple(_data,(const dReal*)_vertices, (int)vertex_count, _indices, (int)index_count);{CODE}
to
{CODE(wrap="1")} dGeomTriMeshDataBuildSimple(_data,(const dReal*)_vertices, (int)vertex_count, (dTriIndex*)_indices, (int)index_count);{CODE}

Thanks to ((Compile OgreOde|rewb0rn)) for that hint!

* Add all c++ files from ogreaddons\ogreode\src and all from ogreaddons\ogreode\include to the OgreOde_Core project in Code::Blocks
* Compile! After the linking Code::Blocks might throw an error because of the post compile copy script. Ignore that and
* copy the output DLL from ogreaddons\ogreode\lib\Release (and later ogreaddons\ogreode\prefab\lib\Release) to $(OGRE_HOME)\bin\Release by hand
* Compile TinyXML, change paths in OgreOde_prefab and compile that one too

!!OgreOde_loader
To compile the OgreOde_loader:
* Import the VC++ project from ogreaddons\ogreode\loader\scripts\VC8 with Code::Blocks (select 'All Files (*.*)' if you can't find it)
* Change the directories, 'debug win32' (or 'release win32') would be just 'debug' (or 'release') these days

{CODE(wrap="1")} Search directories -> Compiler:
   Change $(ODE_HOME)\include to $(OGRE_HOME)\ogreaddons\ogreode\ode\include
   Add $(OGRE_HOME)\ogreaddons\ogreode\loader\include

 Search directories -> Linker:
   $(OGRE_HOME)\lib to $(OGRE_HOME)\bin\Debug or $(OGRE_HOME)\bin\Release{CODE}
* Compile and copy the dll from ogreaddons\ogreode\loader\lib\Debug Win32 (or Release Win32) to $(OGRE_HOME)\bin\debug (or release)

!!Demos
To compile the demos:
* Remove the stlport wherever you can find it
* Add OgreOde_loader to the project's link libraries
* Add OIS to the linker project's link libraries
* Compile

Getting the demos running is a tricky job because you need to provide Ogre's as well as OgreODE's media directory. Give it a try or take a look at the [http://www.ogre3d.org/phpBB2addons/viewtopic.php?p=41948#41948|forum thread].

!!Conclusion
If you experience any linking problems try adding OGREODEEXPORT_LOADER to the compiler defines. Because the post compile copy scripts didn't work for me I couldn't run the demos without changing resources.cfg, maybe someone can figure out what's wrong there. I'm gonna take a coffee break :)

written by ''Daerst'', April 27, 2008

You may now want to [http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=7080|discuss] in the OgreOde forum, continue with the article ((First steps with OgreODE)) or have a look at the ((OgreODE)) home.