Goal : Compiling ogre on Windows without cygwin, pkgconfig, autotools, bootstrap, etc etc) .
== WIKIED August 05==
UPDATE August 05 : A newer version of this guide has been put on wiki. See http://www.ogre3d.org/wiki/index.php/Bu ... se_And_GCC
This post is following my previous post about Eclipse + Cygwin :
http://www.ogre3d.org/phpBB2/viewtopic.php?t=8741
I didn't want to use cygwin anymore, because I find its gcc to old...

So I switched to pure MinGW.
Here is a complete verbous step-by-step instructions to compile and run one Ogre sample.
Go directly to part 3 if you have a functional Eclipse with MinGW 3.4 and CDT 3.0.
TODO : Post a table with all project settings for every samples/plugins.
TODO : Make a .zip containing all the Eclipse project file. Sort of SDK.
TODO : Post a example of simple ogre Hello program. However, should be very similar to the part 5 of my previous thread (except the cygwin specific settings). See http://www.ogre3d.org/phpBB2/viewtopic.php?t=8741.
TODO : Add this on the wiki.
1 - Install MinGW and Mysys.
I am on a Windows platform so I used the MinGW version 3.4.4 + MYSys.
(AFAIK, there is no 4.0 version of gcc for windows (MinGW). The MinGW developer forum suggest that because of regressions they will wait until 4.0.2 at least.)
1.1 - Test your environment
- Open a "Command window" and type "gcc -v" and "strip -V"
If you get something like: "gcc version 3.4.4 (mingw special)" and "strip 2.15.94", then you have a functional MinGW + MSYS, you can skip this part.
1.2 - Install MinGW
There can be conflit if you have another gcc (for examples from cygwin).
Because I didn't need cygwin anymore I uninstalled it!
If you need cygwin, I am not sure what you must do. Because if you change the environment variable PATH, cygwin will not work anymore.
So what I suggest is to change the PATH variable WITHIN Eclipse (see point 1.4 and 4.3) and cygwin should still work normaly.
You need at least the following from the MinGW site :
binutils
w32api
mingw-runtime
gcc-core
gcc-g++
gdb
Install them in a directory (for example C:\tools\mingw).
1.3 - Install MSYS.
For example C:\tools\mysy .
CAREFUL : It must not be in the same directory as mingw (both bin directories must not be merged).
1.4 - Set the PATH variable.
If you have cygwin, you will need to replace the PATH in Eclipse (see 4.3).
If you don't have cygwin, you can simply set the environment variable PATH to point to both bin directories.
You can test you installation by doing the 1.1 part.
2 - Install Eclipse
(See the thread to see how to install Eclipse : http://www.ogre3d.org/phpBB2/viewtopic.php?t=8741 )
- Download and install : eclipse-SDK-3.1-win32.zip
- Download org.eclipse.cdt-3.0.0-RC2-win32.x86.zip (or later) and uninstall it in the Eclipse directory.
- Create shortcuts to eclipse.exe to lauch Eclipse more easily.
3 - Download and install Ogre
3.1 - Install Ogre
- Unzip ogre-win32-v1-0-3p1.zip in a new directory. I create a "C:\library\Ogre" so I got "C:\library\Ogre\ogrenew" .
- Unzip the content MinGWDependencies-1.0-pre2.tar.bz2 in "ogrenew".
- Rename the directory "mingw" in "Dependencies", you then have "ogrenew/Dependencies/bin", "ogrenew/Dependencies/include", "ogrenew/Dependencies/lib" and "ogrenew/Dependencies/share".
- Copy all .dll from "ogrenew/Dependencies/bin" in "ogrenew/Samples/Common/bin/Release"
3.2 - zlib and zziplib mess !
As of today (July 05) there is a "missing" library file (.a) to build again libzzip-0-10.dll in the MinGWDependencies tar.
Furthermore, ASFAIK, the name of these libraries .a are not following naming conventions... its confusing.
We need to build this a .a library file.
There are two nedded libraries :
zlib1.dll -> project zlib : http://www.zlib.net/
libzzip-0-10.dll -> project zziplib : http://zziplib.sourceforge.net/
CAREFUL: Do not confuse it with this other project : zzip & zzlib : http://debin.net/zzip/ and http://debin.net/zzip/download.php#zzip
The usual way is to use pkg-config on the files provided with OgreDependencies but pkg-config is not available on Win32 except with Cygwin!
I hate to be obliged to install cygwin just for a "simple compilation".
(It makes me mad that pkg-config is advertised as a helper tool... hahaha).
So...
3.2.1 - Zlib
For zlib, we will need to compile OgreMain against libz.dll.a (which should be libzlib.a)
You need to use "g++ .... -lzziplib -lz.dll ... " instead of " -lzziplib -lzlib "
Another way would be to :
- Download zlib123-dll.zip from http://www.zlib.net/
- Uncompress it in a directory
- Open a "Command Window" in this directory and make the following command :
- dlltool --def lib\zlib.def --dllname zlib1.dll --output-lib libzlib.a
This will create the file libzlib.a that we need to compile OgreMain.
- Copy this file in "ogrenew/Dependencies/lib".
3.2.2 - Zziplib
I tried three solution only the last worked. If someone could show me a more elegant way...
3.2.2.1 - Create the .a from the dll
We SHOULD be able to generate the needed .a from the .dll (because the symbols where not stripped).
But it doesn't work. I don't know why. I will put what i did in the hope that someone will find what went wrong :
- Open a Command window in Dependencies/bin and execute the following commands :
echo EXPORTS > zzip.def
nm libzzip-0-10.dll | grep ' T _' | sed 's/.* T _//' >> zziplib.def
dlltool --def zziplib.def --dllname libzzip-0-10.dll --output-lib libzziplib.a
- Copy this libzziplib.a in Dependencies/lib and compile against it.
But the compilation stops with : ../../Dependencies/lib/libzziplib.a(dkts00027.0):: first defined here
I could not find a solution so I tried another solution.
3.2.2.2 - Compile zziplib
I tried to compile zziplib from http://sourceforge.net/project/showfile ... up_id=6389
but without unix tools I can't.
I tried to link against zzipdll.zip (version 0.10.17) but it didn't work.
Can someone show me how to do it with mingw + Msys?

3.2.2.2 - Copy it from CODE::BLOCKS
Ogrenew now compiles... even if the .a is NOT from the same zziplib version !!!
- Get the Code::Blocks dependencies : Download codeblocks-dependencies-1.0.1.zip
at http://sourceforge.net/project/showfile ... _id=149087.
- Unzip the file libzziplib.a in /Dependencies/lib
We could use the dependencies from CodeBlocks but then you would need to change the path libraries a bit.
4 - Configure Eclipse for Ogre
4.1 - Launch Eclipse.
It will ask to open a Workspace (a workspace is created by opening Eclipse in the desired directory).
- Open a workspace in "ogrenew/Scripts".
(CAUTION : NOT in "ogrenew" because you would would't be able to create projects in subdirectories relative to ogrenew !!!
I lost a whole day because of this ! )
4.2 - Modify several default preferences :
- Window -> Preferences -> General -> Perspectives -> Available perspectives : set C/C++ as default.
- Window -> Preferences -> General -> Workspace -> Linked Resources : add a defined path variables : "OgreEclipse" which will contain the full path to the ogrenew directory. For example "C:\library\Ogre\ogrenew".
- Window -> Preferences -> General -> Workspace -> Build automatically : set to false. (You can let it but I found it very annoying. I prefer to build when I want).
Until the next version of CDT the indexer is extremely slow, I suggest that you disable if you only compile Ogre !
- Window -> Preferences -> C/C++ -> Indexer : set to No Indexer !!!
There is a bug, some time when you launch Eclipse again you will need to set No indexer again for each project...

4.3 - Setting environment variables in Eclipse
- Window -> Preferences -> C/C++ -> Managed Build -> Environment : define a new "User Variables" by
selecting the PATH variable and Prepend the value : C:\tools\mingw\bin;C:\tools\mysy\bin; (Don't put it in "" ).
I used only "Managed build project" but you can also do this for "Make Project"
Set it in Window -> Preferences -> C/C++ -> Make -> New Make Project -> Environment.
CAREFUL : For those with Cygwin, it will NOT work because during the first run of Eclipse,
the path to the cygwin bin will be kept somwhere and automatically prepended to the PATH environment !
This means that for EACH project you will need to prepend the correct MinGW bin path to the PATH variable.
See 5.4.2. If you find another solution, let me know !
To be safe, quit and launch Eclipse again.
5 - Compile Ogre with Eclipse
TODO : I will try to make a .zip containing all needed eclipse project files. So that you only need to unzip and click compile !
But until then I will only explain how to compile Ogre to run the sample Demo_BezierPatch.
To run it, we need at least OgreMain.dll, OgrePlatform.dll, Plugin_ParticleFX.dll and RenderSystem_Direct3D9.dll (or RenderSystem_GL.dll).
You will need to work a bit to compile the rest

5.1 - Demo_BezierPatch project : compile Demo_BezierPatch.exe
This executable needs OgreMain.dll to compile but OgreMain is big and the compilation is about 20 min on my pc.
So, to verify if we set up correctly Eclipse we will first try with a small project in Release mode.
It's nearly the same for the Debug but its to see if we can compile.
5.1.1 - Create a new "Managed Make C++ Project" with :
- File -> New -> Managed Make C++ Project :
- Project Name : Demo_BezierPatch
- Project contents -> Directory : OgreEclipse/Samples/BezierPatch (do not use the default one ! OgreEclipse is the variable you set before)
- Click Finish.
If Eclipse ask to open the C/C++ perspective, I recommand that Eclipse remembers your decision.
You can change perspective by clicking on the small icon in the top right of the ide.
Know you should see the files contained in the directory that appear in your Navigator.
5.1.2 - Open the properties of your project.
(Right click on the Demo_BezierPatch folder icon).
- C/C++ Build -> Active configuration -> Configuration : select Release.
- C/C++ Build -> Build Settings -> Buil Command : replace "make -k" by "mingw32-make -k". Click Apply to save it.
It's a "Managed Make" so you can't change the default command... :-/
- C/C++ Build -> Tool Settings -> Preprocessor -> Defined Symbols : add WIN32, NDEBUG and _WINDOWS
- C/C++ Build -> Tool Settings -> Directories -> Include paths : add ../include, ../../Common/include and ../../../OgreMain/include
- C/C++ Build -> Tool Settings -> Libraries -> Libraries : add OgreMain
- C/C++ Build -> Tool Settings -> Libraries -> Library search path : add ../../../OgreMain/Release
- C/C++ Build -> Tool Settings -> Miscellaneous -> Linker flags : -Wl,--enable-runtime-pseudo-reloc
(Do not put a space after the comma it creates a link error difficult to find).
- C/C++ Build -> Build Steps -> Post-build step : put the following line in the Command field and "copy & strip" in the Description field
cp Demo_BezierPatch.exe "../../Common/Bin/Release" ; strip "../../Common/Bin/Release/Demo_BezierPatch.exe"
For Cygwin see 4.2
5.1.3 - Build the project
(You can stop the compilation by clicking on the icon in the bottom right of the ide).
- Build the project, it should exit with the following error :
"..\..\mingw32\bin\ld.exe: cannot find -lOgreMain"
Success! You correctly set up your Eclipse + MinGW + Ogre environment.
If you don't have this there is a problem somewhere !
Now. To compile this sample we need OgreMain.dll.
5.2 - OgreMain project : compiling OgreMain
This will be fairly similar to the last project.
- File -> New -> Managed Make C++ Project :
- Project Name : OgreMain
- Project contents -> Directory : OgreEclipse/OgreMain
- Click next
- Project Type : Shared Library
- Click Finish
Project properties :
- C/C++ Build -> Active configuration -> Configuration : select Release.
- C/C++ Build -> Build Settings -> Buil Command : replace "make -k" by "mingw32-make -k". Click Apply to save it.
- C/C++ Build -> Tool Settings -> Preprocessor -> Defined Symbols : add WIN32, NDEBUG, _USRDLL, _MT, OGRE_NONCLIENT_BUILD
- C/C++ Build -> Tool Settings -> Directories -> Include paths : add ../include, ../../Dependencies/include and ../../Dependencies/include/freetype2
- C/C++ Build -> Tool Settings -> Libraries -> Libraries : add kernel32, user32, z.dll, zziplib, libfreetype, IL, ILU and ILUT
(See point 3.2 if you have a z/zzip/zziplib library compile error)
- C/C++ Build -> Tool Settings -> Libraries -> Library search path : add ../../Dependencies/lib
- C/C++ Build -> Tool Settings -> Miscellaneous -> Linker flags : nothing !
- C/C++ Build -> Build Steps -> Post-build step : put the following line in the Command field and "copy & strip" in the Description field
cp OgreMain.dll "../../Samples/Common/Bin/Release" ; strip "../../Samples/Common/Bin/Release/OgreMain.dll"; cp OgreMain.dll "../../Tools/Common/bin/Release"; strip "../../Tools/Common/bin/Release/OgreMain.dll"
- (Re)Build the project and wait 20 minutes...
There will be 100 warnings, ignore them (or submit a patch

Take a break and a double wiskey, if you have "Build complete for project OgreMain"
5.2.2 - Rebuild Demo_BezierPatch again.
It should build.
5.3 - Build PlatformManager_Win32
5.3.1 - Managed Make
- File -> New -> Managed Make C++ Project :
- Project Name : PlatformManager_Win32
- Project contents -> Directory : OgreEclipse/PlatformManagers/Win32
- Click next
- Project Type : Shared Library
- Click Finish
Project properties :
- C/C++ Build -> Active configuration -> Configuration : select Release.
- C/C++ Build -> Build Settings -> Buil Command : replace "make -k" by "mingw32-make -k". Click Apply to save it.
- C/C++ Build -> Tool Settings -> Preprocessor -> Defined Symbols : add WIN32, NDEBUG, _WINDOWS, _USRDLL, PLATFORMMANAGER_WIN32_EXPORTS
- C/C++ Build -> Tool Settings -> Directories -> Include paths : add ../include, ../../OgreMain/include, ../misc and ../../Dependencies/include
- C/C++ Build -> Tool Settings -> Libraries -> Libraries : add OgreMain, dxguid, dinput8 and dinput
- C/C++ Build -> Tool Settings -> Libraries -> Library search path : add ../../../OgreMain/Release, ../../../Dependencies/lib
- C/C++ Build -> Tool Settings -> Miscellaneous -> Linker flags : -Wl,--enable-runtime-pseudo-reloc
- C/C++ Build -> Build Steps -> Post-build step : put the following line in the Command field and "copy & strip" in the Description field
cp PlatformManager_Win32.dll "../../../Samples/Common/Bin/Release/OgrePlatform.dll" ; strip "../../../Samples/Common/Bin/Release/OgrePlatform.dll"
- (Re)Build the project...
There will be about 9 warnings... ignore them.
5.3.2 - Compiling win32 resources (OgreWin32Resources.rc)
There is a catch ! OgreWin32Resources.rc must be compiled with windres.
If you execute ogrenew/Samples/Common/bin/Release/Demo_BezierPatch.exe ,
and you get the following message appears, you need to compile the win32 resource .rc :
Code: Select all
Error #: 1812
Function: Win32ConfigDialog::display
- Open the C/C++ Build view :
- Exclude from build must not be set.
- Configuration : Release
- Custom Build Step Applicability : Apply Custom Build Step Overriding Other Tools
- Output file name(s) : OgreWin32Resources.o
- Command : windres -o "./misc/OgreWin32Resources.o" -I"../misc" -I"../include" "../misc/OgreWin32Resources.rc"
- Description : Win32 Resources Compilation
- Project Properties :
- C/C++ Build -> Linker -> Miscellaneous -> Other objects : ./misc/OgreWin32Resources.o
- (Re)build the project.
5.3.3 - Plugins.cfg
- Open ogrenew/Samples/Common/bin/Release/Plugins.cfg (it define which plugin will be loaded by ogre)
- Modified it (for this project) as follow :
Code: Select all
# Defines plugins to load
# Define plugin folder
PluginFolder=.
# Define plugins
#Plugin=RenderSystem_Direct3D7
Plugin=RenderSystem_Direct3D9
#Plugin=RenderSystem_GL
Plugin=Plugin_ParticleFX
#Plugin=Plugin_BSPSceneManager
#Plugin=Plugin_OctreeSceneManager
#Plugin=Plugin_CgProgramManager
5.4 - Build RenderSystem_Direct3d9
- File -> New -> Managed Make C++ Project :
- Project Name : RenderSystem_Direct3D9
- Project contents -> Directory : OgreEclipse/RenderSystems/Direct3D9
- Click next
- Project Type : Shared Library
- Click Finish
Project properties :
- C/C++ Build -> Active configuration -> Configuration : select Release.
- C/C++ Build -> Build Settings -> Buil Command : replace "make -k" by "mingw32-make -k". Click Apply to save it.
- C/C++ Build -> Tool Settings -> Preprocessor -> Defined Symbols : add WIN32, NDEBUG, _WINDOWS, _USRDLL, OGRE_NONCLIENT_BUILD, OGRED3ENGINEDLL_EXPORTS
- C/C++ Build -> Tool Settings -> Directories -> Include paths : add ../include, ../../OgreMain/include and ../../Dependencies/include
- C/C++ Build -> Tool Settings -> Libraries -> Libraries : add OgreMain, gdi32, d3d9, d3dx9d, dxerr9, dxguid
- C/C++ Build -> Tool Settings -> Libraries -> Library search path : add ../../../OgreMain/Release, ../../../Dependencies/lib
- C/C++ Build -> Tool Settings -> Miscellaneous -> Linker flags : -Wl,--enable-runtime-pseudo-reloc
- C/C++ Build -> Build Steps -> Post-build step : put the following line in the Command field and "copy & strip" in the Description field
cp RenderSystem_Direct3D9.dll "../../../Samples/Common/Bin/Release" ; strip "../../../Samples/Common/Bin/Release/RenderSystem_Direct3D9.dll"
- (Re)Build the project... There will be warnings... ignore them.
- Run Demo_BezierPatch.exe. The option window should open.
- Select the only rendery system you have : direct3d9
- Set full screen to No (for now) and click ok.
An exception will occur : Error #: 4 : Cannot find requested emitter type.
5.5 - Build Plugin_ParticleFX
- File -> New -> Managed Make C++ Project :
- Project Name : Plugin_ParticleFX
- Project contents -> Directory : OgreEclipse/Plugins/ParticleFX
- Click next
- Project Type : Shared Library
- Click Finish
Project properties :
- C/C++ Build -> Active configuration -> Configuration : select Release.
- C/C++ Build -> Build Settings -> Buil Command : replace "make -k" by "mingw32-make -k". Click Apply to save it.
- C/C++ Build -> Tool Settings -> Preprocessor -> Defined Symbols : add WIN32, NDEBUG, _WINDOWS, _USRDLL, PLUGIN_ParticleFX_EXPORTS
- C/C++ Build -> Tool Settings -> Directories -> Include paths : add ../include, ../../OgreMain/include and ../../Dependencies/include
- C/C++ Build -> Tool Settings -> Libraries -> Libraries : add OgreMain
- C/C++ Build -> Tool Settings -> Libraries -> Library search path : add ../../../OgreMain/Release, ../../../Dependencies/lib
- C/C++ Build -> Tool Settings -> Miscellaneous -> Linker flags : -Wl,--enable-runtime-pseudo-reloc
- C/C++ Build -> Build Steps -> Post-build step : put the following line in the Command field and "copy & strip" in the Description field
cp Plugin_ParticleFX.dll "../../../Samples/Common/Bin/Release" ; strip "../../../Samples/Common/Bin/Release/Plugin_ParticleFX.dll"
- (Re)Build the project... There will be about 58 warnings... ignore them.
5.6 - Running Demo_BezierPatch.exe
You can either :
- Go in the ogremain/Samples/bin/Release
- Run Demo_BezierPatch.exe. The option window should open.
- Select the only rendery system you have : direct3d9
- If not already done, make the change in Plugins.cfg (see 5.3.3)
- Set full screen to No (for now) and click ok.
Or in Eclipse :
- Run -> Run... : will open a option panel to "Create, manage and run configurations"
- Create a new "C/C++ Local Application"
- Main -> C/C++ Application : Browse to find the executable in /Samples/Common/bin/Release
- Click run
- Select the only rendery system you have : direct3d9
- If not already done, make the change in Plugins.cfg (see 5.3.3)
- Set full screen to No (for now) and click ok.
Congratulations... you have compiled a sample of Ogre.