Compiling Branch 2.1 Windows 8.1 with VS2015

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
Posts: 23
Joined: Sun Jul 17, 2011 1:35 am
x 1

Compiling Branch 2.1 Windows 8.1 with VS2015

Post by criatura »

This is just a compilation of information that can be found in the forums, manuals, etc. Maybe is redundant, but I prefer to share it anyways.

Interesting websites:

Important things to consider:
  • You compile the dependencies because if libs are compiled using different compilers, you can get linking errors when you use them (because they can be compiled against different versions of standard library for example).
    If you build Ogre for 64 bits plattforms. You should compile all the dependencies for 64 bits.
    If you have some strange compilation errors, the easiest thing to try is to start again the compilation, deleting the cache from cmake-egui and creating another build folder to create the files.
I followed this guide: ... indows-8-1

However I used another Dependencies repository, recommended in the forum:

I didn't made the subst step because I got an invalid parameter error.

The first step is to download visual studio community edition 2015 (it is free), from microsoft website: ... ty-vs.aspx

It will require to install windows updates and all the process (downloading windows updates and visual studio) can be very long (around four hours, depending on internet connection speed).

Download libsdl2 source from

download libsdl2 source code (zip file), open VisualC folder, open the SDL_VS2013 file and compile. Maybe you will get an the error: dxsdkver.h file not found. Just comment the include of dxsdkver.h in SDL_xaudio2.c and it will compile.

Then I compiled ogre dependencies repo using visual studio (Opening file Ogredeps):

Got a compilation error in freeimage related to macros and snprintf. Fixed commenting the following lines
#ifdef _WIN32
#define snprintf _snprintf
#define lfind _lfind
#endif // _WIN32
from the file tif_config.h

Then it compiled ok.

Once having Ogre dependencies compiled and sdl2 compiled you can try to compile Ogre.

open cmake-gui, select Ogre src folder, create a build folder and set it as destination for the binaries.

In the cmake-gui dialog you just need to make the following:

activate OGRE_BUILD_SAMPLES2 if you need the samples.
set OGRE_DEPENDENCIES_DIR to the folder where you built the dependencies, in my case: C:/Projects/cabalistic-ogredeps/build/ogredeps
select SDL2MAIN_LIBRARY and SDL_LIBRARY (in my case C:/Projects/Dependencies/SDL2-2.0.3/SDL2-2.0.3/VisualC/SDL/x64/Debug/SDL2.lib).
select SDL2_INCLUDE_DIR (in my case C:/Projects/Dependencies/SDL2-2.0.3/SDL2-2.0.3/include).

Then just generate, compile and align your chakras.

After compiling the ALL_BUILD solution (if no errors), compile the INSTALL solution. This will generate a folder called sdk. In sdk/debug/bin you will have all the libraries/executable. In my case, I had SDL lib separated from Dependencies folder. When I tried to run an example, I got an error of missing SDL2.dll, I just copied the SLD2.dll to the sdk/debug/bin and it worked fine.

In the process I had several problems, I didn't document each one, I recompiled a couple of times the dependencies, SDL, Ogre, etc. Until I got all working. Here some problems that I ramdonly found in the way (without making any step "outside" of what I readed on the forums / documentation):

For some reason I got linking problems of Ogre against FreeImage (someting related with libs generated using different VC Compiler, but until I remember, always used the same compiler/configuration). Something like this:
_MSC_VER': value '1900' doesn't match value '1800'... Sorry but I didn't saved the exact message.

When compiling dependencies again I had some throubles building the "install" solution (to move libs and headers inside a folder), I had to replace all occurrences of C:/Program Files/Project by C:/Projects/cabalistic-ogredeps/build3. The variable CMAKE_INSTALL_PREFIX, was wrong. (I made the search/replace of the strings automatically using a program).

Another problem was zlib.h not found when compiling zzlib. To solve it, just select zzlib from project explorer, click properties, configuration properties,VC++ directories, edit include directories and add the zlib folder.

When I got errors, I just created a new "build" folder, and selected under cmake-gui dialog. I tried several times, until I got it working. This is the random part, I never knew what was the source of my problems. I deleted the cache from cmake-gui and compiled sources to new folders several times. I always used Ogre in Linux, maybe my problems are related to my inexperience under windows development environment.

Post Reply