Compiling on Windows with MinGW and Code::Blocks

From Secret Maryo Chronicles Wiki
Jump to: navigation, search

This is a guide for compiling Secret Maryo Chronicles on Windows with MinGW and Code::Blocks. It was written and tested on Windows XP SP3.

Contents

Setting up MinGW

Before you ask: this MinGW release you're telling me to install is quite old, it installs GCC 4.6.2 - can I install the shiny, latest GCC 4.7.2? The answer is, unfortunately, no. Because with 4.7.2 even though everything compiles fine, SMC.exe crashes upon startup with an assertion failure at src/video/video.cpp in cVideo::Delete_CEGUI_Fake(). With 4.6.2 everything compiles and runs perfectly. Maybe it's time to upgrade to CEGUI 0.8.2?

Get mingw-get-inst-20120426.exe from MinGW's files section and run it. Choose "Use pre-packaged repository catalogues 20120426" when prompted to do so during installation.

Install MinGW to C:\MinGW.

Choose the following components during installation: C Compiler, C++ Compiler, and MinGW Developer ToolKit.

After installation is complete, create folder libs under C:\MinGW.

Setting up Code::Blocks

Get codeblocks-12.11-setup.exe from Code::Blocks' download page - we DON'T want the one which bundles a MinGW distribution.

Install Code::Blocks.

Preparing for compiling

Dependencies

SDL

Get SDL-devel-1.2.15-mingw32.tar.gz from SDL's historic download page. Also get SDL_image 1.2.12, SDL_mixer 1.2.12 and SDL_ttf 2.0.11.

Put the bin/include/lib folders under C:\MinGW\libs\SDL-1.2.15.

Boost

Get boost_1_54_0.7z from Boost's files section and extract it to C:\MinGW\libs. After it's done extracting, rename the extracted folder boost_1_54_0 to boost-1.54.0.

Run cmd.exe to open a command prompt and run the following commands:

SET PATH=C:\MinGW\bin;%PATH%
SET BOOST_ROOT=C:\MinGW\libs\boost-1.54.0
cd %BOOST_ROOT%\tools\build\v2\
bootstrap.bat gcc
b2 toolset=gcc install --prefix=%BOOST_ROOT%\b2
cd %BOOST_ROOT%
b2\bin\b2 -j %NUMBER_OF_PROCESSORS% -a toolset=gcc --with-chrono --with-date_time --with-filesystem --with-system --with-thread --with-timer link=shared runtime-link=shared threading=multi threading=multi variant=debug,release --stagedir=%BOOST_ROOT%

Now take a look at C:\MinGW\libs\boost-1.54.0\lib - the .dll.a import libraries (for linking) and the DLLs (for distribution) should be there.

CEGUI

Get the CEGUI 0.7.9 Library Source Download (the zip archive) and the CEGUI 0.7.9 Binary Dependency Downloads for MinGW from the CEGUI Downloads 0.7.9 page.

Extract CEGUI-0.7.9.zip to C:\MinGW\libs. When it's done, extract CEGUI-DEPS-0.7.x-r1-mingw.zip to C:\MinGW\libs\CEGUI-0.7.9. You should now have all dependencies under C:\MinGW\libs\CEGUI-0.7.9\dependencies.

Edit C:\MinGW\libs\CEGUI-0.7.9\projects\premake\config.lua and change line 123 to

DIRECT3D9_RENDERER = false

and line 128 to

NULL_RENDERER = true

Run cmd.exe to open a command prompt and run these commands:

SET PATH=C:\MinGW\bin;%PATH%
cd C:\MinGW\libs\CEGUI-0.7.9\projects\premake
premake --file cegui.lua --target cb-gcc

You should now have a new file in C:\MinGW\CEGUI-0.7.9\projects\premake : CEGUI.workspace.

Open CEGUI.workspace in Code::Blocks. The CEGUI workspace should have a number of projects under it, and CEGUIBase should be the active project.

Right-click CEGUIBase and choose Build options.... In the dialog that appears, click the CEGUIBase target (the root of the target tree), then the Linker settings tab. Under Link libraries:, click Add and type

shlwapi

Click OK then OK again.

In the Build menu, click Build workspace. For some reason, after CEGUIBase finished building I had to click Build workspace again in order to build all projects in the workspace; it could be the case you need to do so as well. Build both Debug and Release targets.

Now take a look at C:\MinGW\libs\CEGUI-0.7.9\bin and C:\MinGW\libs\CEGUI-0.7.9\lib - the DLLs and import libraries are ready for use.

Nice freebie: the dependencies package bundles ready-to-use development packages (bin/include/lib) of a bunch of useful libraries: DevIL, Expat, Freeglut, FreeImage, FreeType, libjpeg, libmng, libpng, libtiff, PCRE, SILLY, Xerces, and zlib. Really handy if you don't want/need to build them yourself.

Getting the source code and setting it up

Create the following folder tree under C:\ :

C:\
  |
  \dev
    |
    \cpp
      |
      \projects
           |
           \SMC

Go to FluXy's SMC repository on GitHub and click Download ZIP. After it's done downloading, uncompress it to some temporary folder, then copy the data, docs and src folders and the .xsd files to C:\Dev\cpp\projects\SMC. Finally, copy makefiles/MSVC9.0/idr_main.ico to C:\Dev\cpp\projects\SMC and rename it to smc.ico.

Create empty file smc.rc under C:\Dev\cpp\projects\SMC, open it and paste the following contents:

#include "src/core/global_game.h"
1 ICON DISCARDABLE "smc.ico"
1 VERSIONINFO
FILEVERSION    SMC_VERSION_MAJOR,SMC_VERSION_MINOR,SMC_VERSION_PATCH,0
PRODUCTVERSION SMC_VERSION_MAJOR,SMC_VERSION_MINOR,SMC_VERSION_PATCH,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904E4"
        BEGIN
            VALUE "CompanyName"    , "SMC Team"
            VALUE "FileDescription", CAPTION
            VALUE "FileVersion"    , "2.0.0.0"
            VALUE "ProductName"    , CAPTION
            VALUE "ProductVersion" , "2.0.0.0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
END

Create empty file SMC.cbp under C:\Dev\cpp\projects\SMC, open it and paste the following contents:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="SMC" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/SMC" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
					<Add option="-D_DEBUG=1" />
				</Compiler>
				<Linker>
					<Add library="boost_filesystem-mgw46-mt-d-1_54" />
					<Add library="boost_system-mgw46-mt-d-1_54" />
					<Add library="boost_thread-mgw46-mt-d-1_54" />
					<Add library="intl" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\bin\CEGUIBase_d.dll" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\bin\CEGUINullRenderer_d.dll" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\bin\CEGUIOpenGLRenderer_d.dll" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\dependencies\lib\dynamic\libpng_d.a" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\dependencies\lib\dynamic\libzlib_d.a" />
				</Linker>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/SMC" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="0" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
					<Add option="-DNDEBUG=1" />
				</Compiler>
				<Linker>
					<Add option="-s" />
					<Add library="boost_filesystem-mgw46-mt-1_54" />
					<Add library="boost_system-mgw46-mt-1_54" />
					<Add library="boost_thread-mgw46-mt-1_54" />
					<Add library="intl" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\bin\CEGUIBase.dll" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\bin\CEGUINullRenderer.dll" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\bin\CEGUIOpenGLRenderer.dll" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\dependencies\lib\dynamic\libpng.a" />
					<Add library="..\..\..\..\MinGW\libs\CEGUI-0.7.9\dependencies\lib\dynamic\libzlib.a" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
			<Add directory="../../../../MinGW/libs/boost-1.54.0" />
			<Add directory="../../../../MinGW/libs/CEGUI-0.7.9/dependencies/include" />
			<Add directory="../../../../MinGW/libs/CEGUI-0.7.9/include" />
			<Add directory="../../../../MinGW/libs/SDL-1.2.15/include/SDL" />
		</Compiler>
		<Linker>
			<Add library="mingw32" />
			<Add library="SDLmain" />
			<Add library="SDL.dll" />
			<Add library="SDL_mixer" />
			<Add library="SDL_image" />
			<Add library="SDL_ttf" />
			<Add library="user32" />
			<Add library="gdi32" />
			<Add library="winmm" />
			<Add library="dxguid" />
			<Add library="glu32" />
			<Add library="opengl32" />
			<Add directory="../../../../MinGW/libs/boost-1.54.0/lib" />
			<Add directory="../../../../MinGW/libs/CEGUI-0.7.9/dependencies/lib" />
			<Add directory="../../../../MinGW/libs/SDL-1.2.15/lib" />
		</Linker>
		<Unit filename="smc.ico" />
		<Unit filename="smc.rc">
			<Option compilerVar="WINDRES" />
		</Unit>
		<Unit filename="src/audio/audio.cpp" />
		<Unit filename="src/audio/audio.h" />
		<Unit filename="src/audio/random_sound.cpp" />
		<Unit filename="src/audio/random_sound.h" />
		<Unit filename="src/audio/sound_manager.cpp" />
		<Unit filename="src/audio/sound_manager.h" />
		<Unit filename="src/core/camera.cpp" />
		<Unit filename="src/core/camera.h" />
		<Unit filename="src/core/campaign_manager.cpp" />
		<Unit filename="src/core/campaign_manager.h" />
		<Unit filename="src/core/collision.cpp" />
		<Unit filename="src/core/collision.h" />
		<Unit filename="src/core/editor.cpp" />
		<Unit filename="src/core/editor.h" />
		<Unit filename="src/core/file_parser.cpp" />
		<Unit filename="src/core/file_parser.h" />
		<Unit filename="src/core/filesystem/filesystem.cpp" />
		<Unit filename="src/core/filesystem/filesystem.h" />
		<Unit filename="src/core/filesystem/resource_manager.cpp" />
		<Unit filename="src/core/filesystem/resource_manager.h" />
		<Unit filename="src/core/framerate.cpp" />
		<Unit filename="src/core/framerate.h" />
		<Unit filename="src/core/game_core.cpp" />
		<Unit filename="src/core/game_core.h" />
		<Unit filename="src/core/global_basic.h" />
		<Unit filename="src/core/global_game.h" />
		<Unit filename="src/core/i18n.cpp" />
		<Unit filename="src/core/i18n.h" />
		<Unit filename="src/core/main.cpp" />
		<Unit filename="src/core/main.h" />
		<Unit filename="src/core/math/line.h" />
		<Unit filename="src/core/math/point.h" />
		<Unit filename="src/core/math/rect.h" />
		<Unit filename="src/core/math/size.h" />
		<Unit filename="src/core/math/utilities.cpp" />
		<Unit filename="src/core/math/utilities.h" />
		<Unit filename="src/core/math/vector.cpp" />
		<Unit filename="src/core/math/vector.h" />
		<Unit filename="src/core/obj_manager.h" />
		<Unit filename="src/core/property_helper.cpp" />
		<Unit filename="src/core/property_helper.h" />
		<Unit filename="src/core/sprite_manager.cpp" />
		<Unit filename="src/core/sprite_manager.h" />
		<Unit filename="src/enemies/bosses/turtle_boss.cpp" />
		<Unit filename="src/enemies/bosses/turtle_boss.h" />
		<Unit filename="src/enemies/eato.cpp" />
		<Unit filename="src/enemies/eato.h" />
		<Unit filename="src/enemies/enemy.cpp" />
		<Unit filename="src/enemies/enemy.h" />
		<Unit filename="src/enemies/flyon.cpp" />
		<Unit filename="src/enemies/flyon.h" />
		<Unit filename="src/enemies/furball.cpp" />
		<Unit filename="src/enemies/furball.h" />
		<Unit filename="src/enemies/gee.cpp" />
		<Unit filename="src/enemies/gee.h" />
		<Unit filename="src/enemies/krush.cpp" />
		<Unit filename="src/enemies/krush.h" />
		<Unit filename="src/enemies/rokko.cpp" />
		<Unit filename="src/enemies/rokko.h" />
		<Unit filename="src/enemies/spika.cpp" />
		<Unit filename="src/enemies/spika.h" />
		<Unit filename="src/enemies/spikeball.cpp" />
		<Unit filename="src/enemies/spikeball.h" />
		<Unit filename="src/enemies/static.cpp" />
		<Unit filename="src/enemies/static.h" />
		<Unit filename="src/enemies/thromp.cpp" />
		<Unit filename="src/enemies/thromp.h" />
		<Unit filename="src/enemies/turtle.cpp" />
		<Unit filename="src/enemies/turtle.h" />
		<Unit filename="src/gui/generic.cpp" />
		<Unit filename="src/gui/generic.h" />
		<Unit filename="src/gui/hud.cpp" />
		<Unit filename="src/gui/hud.h" />
		<Unit filename="src/gui/menu.cpp" />
		<Unit filename="src/gui/menu.h" />
		<Unit filename="src/gui/menu_data.cpp" />
		<Unit filename="src/gui/menu_data.h" />
		<Unit filename="src/gui/spinner.cpp" />
		<Unit filename="src/gui/spinner.h" />
		<Unit filename="src/input/joystick.cpp" />
		<Unit filename="src/input/joystick.h" />
		<Unit filename="src/input/keyboard.cpp" />
		<Unit filename="src/input/keyboard.h" />
		<Unit filename="src/input/mouse.cpp" />
		<Unit filename="src/input/mouse.h" />
		<Unit filename="src/level/level.cpp" />
		<Unit filename="src/level/level.h" />
		<Unit filename="src/level/level_background.cpp" />
		<Unit filename="src/level/level_background.h" />
		<Unit filename="src/level/level_editor.cpp" />
		<Unit filename="src/level/level_editor.h" />
		<Unit filename="src/level/level_manager.cpp" />
		<Unit filename="src/level/level_manager.h" />
		<Unit filename="src/level/level_player.cpp" />
		<Unit filename="src/level/level_player.h" />
		<Unit filename="src/level/level_settings.cpp" />
		<Unit filename="src/level/level_settings.h" />
		<Unit filename="src/objects/animated_sprite.cpp" />
		<Unit filename="src/objects/animated_sprite.h" />
		<Unit filename="src/objects/ball.cpp" />
		<Unit filename="src/objects/ball.h" />
		<Unit filename="src/objects/bonusbox.cpp" />
		<Unit filename="src/objects/bonusbox.h" />
		<Unit filename="src/objects/box.cpp" />
		<Unit filename="src/objects/box.h" />
		<Unit filename="src/objects/enemystopper.cpp" />
		<Unit filename="src/objects/enemystopper.h" />
		<Unit filename="src/objects/goldpiece.cpp" />
		<Unit filename="src/objects/goldpiece.h" />
		<Unit filename="src/objects/level_entry.cpp" />
		<Unit filename="src/objects/level_entry.h" />
		<Unit filename="src/objects/level_exit.cpp" />
		<Unit filename="src/objects/level_exit.h" />
		<Unit filename="src/objects/moving_platform.cpp" />
		<Unit filename="src/objects/moving_platform.h" />
		<Unit filename="src/objects/movingsprite.cpp" />
		<Unit filename="src/objects/movingsprite.h" />
		<Unit filename="src/objects/path.cpp" />
		<Unit filename="src/objects/path.h" />
		<Unit filename="src/objects/powerup.cpp" />
		<Unit filename="src/objects/powerup.h" />
		<Unit filename="src/objects/spinbox.cpp" />
		<Unit filename="src/objects/spinbox.h" />
		<Unit filename="src/objects/sprite.cpp" />
		<Unit filename="src/objects/sprite.h" />
		<Unit filename="src/objects/star.cpp" />
		<Unit filename="src/objects/star.h" />
		<Unit filename="src/objects/text_box.cpp" />
		<Unit filename="src/objects/text_box.h" />
		<Unit filename="src/overworld/overworld.cpp" />
		<Unit filename="src/overworld/overworld.h" />
		<Unit filename="src/overworld/world_editor.cpp" />
		<Unit filename="src/overworld/world_editor.h" />
		<Unit filename="src/overworld/world_layer.cpp" />
		<Unit filename="src/overworld/world_layer.h" />
		<Unit filename="src/overworld/world_manager.cpp" />
		<Unit filename="src/overworld/world_manager.h" />
		<Unit filename="src/overworld/world_player.cpp" />
		<Unit filename="src/overworld/world_player.h" />
		<Unit filename="src/overworld/world_sprite_manager.cpp" />
		<Unit filename="src/overworld/world_sprite_manager.h" />
		<Unit filename="src/overworld/world_waypoint.cpp" />
		<Unit filename="src/overworld/world_waypoint.h" />
		<Unit filename="src/user/preferences.cpp" />
		<Unit filename="src/user/preferences.h" />
		<Unit filename="src/user/savegame.cpp" />
		<Unit filename="src/user/savegame.h" />
		<Unit filename="src/video/animation.cpp" />
		<Unit filename="src/video/animation.h" />
		<Unit filename="src/video/color.h" />
		<Unit filename="src/video/font.cpp" />
		<Unit filename="src/video/font.h" />
		<Unit filename="src/video/gl_surface.cpp" />
		<Unit filename="src/video/gl_surface.h" />
		<Unit filename="src/video/img_manager.cpp" />
		<Unit filename="src/video/img_manager.h" />
		<Unit filename="src/video/img_settings.cpp" />
		<Unit filename="src/video/img_settings.h" />
		<Unit filename="src/video/renderer.cpp" />
		<Unit filename="src/video/renderer.h" />
		<Unit filename="src/video/video.cpp" />
		<Unit filename="src/video/video.h" />
		<Extensions>
			<DoxyBlocks>
				<comment_style block="0" line="0" />
				<doxyfile_project />
				<doxyfile_build />
				<doxyfile_warnings />
				<doxyfile_output />
				<doxyfile_dot />
				<general />
			</DoxyBlocks>
			<code_completion />
			<envvars />
			<debugger />
		</Extensions>
	</Project>
</CodeBlocks_project_file>

Compiling

You'll have to patch a few files.

src/core/campaign_manager.cpp

--- campaign_manager.cpp.orig	2013-08-27 21:15:42 +0000
+++ campaign_manager.cpp	2013-08-30 00:21:23 +0000
@@ -42,7 +42,7 @@
 bool cCampaign :: Save( const std::string &filename )
 {
 // fixme : Check if there is a more portable way f.e. with imbue()
-#ifdef _WIN32
+#ifdef _MSC_VER
 	ofstream file( utf8_to_ucs2( filename ).c_str(), ios::out | ios::trunc );
 #else
 	ofstream file( filename.c_str(), ios::out | ios::trunc );

src/core/filesystem/filesystem.cpp

--- filesystem.cpp.orig	2013-08-27 21:15:42 +0000
+++ filesystem.cpp	2013-08-30 00:23:59 +0000
@@ -21,10 +21,14 @@
 // needed for the stat function and to get the user directory on unix
 #include <sys/stat.h>
 #include <sys/types.h>
-#if _WIN32
+#if _MSC_VER
 	// needed to get the user directory (SHGetFolderPath)
 	#include <shlobj.h>
 #endif
+#if __MINGW32__
+	// needed for rmdir()
+	#include <unistd.h>
+#endif
 
 namespace SMC
 {
@@ -73,7 +77,7 @@
 bool Delete_File( const std::string &filename )
 {
 // fixme : boost should use a codecvt_facet but for now we convert to UCS-2
-#ifdef _WIN32
+#ifdef _MSC_VER
 	return DeleteFile( utf8_to_ucs2( filename ).c_str() ) != 0;
 #else
 	return remove( filename.c_str() ) == 0;
@@ -83,7 +87,7 @@
 bool Delete_Dir( const std::string &dir )
 {
 // fixme : boost should use a codecvt_facet but for now we convert to UCS-2
-#ifdef _WIN32
+#ifdef _MSC_VER
 	return RemoveDirectory( utf8_to_ucs2( dir ).c_str() ) != 0;
 #else
 	return rmdir( dir.c_str() ) == 0;
@@ -103,7 +107,7 @@
 bool Rename_File( const std::string &old_filename, const std::string &new_filename )
 {
 // fixme : boost should use a codecvt_facet but for now we convert to UCS-2
-#ifdef _WIN32
+#ifdef _MSC_VER
 	return MoveFileEx( utf8_to_ucs2( old_filename ).c_str(), utf8_to_ucs2( new_filename ).c_str(), MOVEFILE_REPLACE_EXISTING ) != 0;
 #else
 	return rename( old_filename.c_str(), new_filename.c_str() ) == 0;
@@ -118,7 +122,7 @@
 	}
 
 // fixme : boost should use a codecvt_facet but for now we convert to UCS-2
-#ifdef _WIN32
+#ifdef _MSC_VER
 	return CreateDirectory( utf8_to_ucs2( dir ).c_str(), NULL ) != 0;
 #else
 	return fs::create_directory( fs::path( dir ) );
@@ -226,7 +230,7 @@
 
 std::string Get_Temp_Directory( void )
 {
-#ifdef _WIN32
+#ifdef _MSC_VER
 	TCHAR path[MAX_PATH];
 
 	DWORD retval = GetTempPath( MAX_PATH, path );
@@ -248,7 +252,7 @@
 
 std::string Get_User_Directory( void )
 {
-#ifdef _WIN32
+#ifdef _MSC_VER
 	TCHAR path_appdata[MAX_PATH + 1];
 
 	if( FAILED( SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path_appdata ) ) )
@@ -267,6 +271,8 @@
 	WriteConsole( std_out, str.c_str(), lstrlen(str.c_str()), &chars, NULL );*/
 
 	return str_path + "/smc/";
+#elif __MINGW32__
+        return ( std::string )getenv( "USERPROFILE" ) + "/.smc/";
 #elif __unix__
 	return (std::string)getenv( "HOME" ) + "/.smc/";
 #elif __APPLE__

src/level/level.cpp

--- level.cpp.orig	2013-08-27 21:15:42 +0000
+++ level.cpp	2013-08-30 00:22:47 +0000
@@ -283,7 +283,7 @@
 	}
 
 // fixme : Check if there is a more portable way f.e. with imbue()
-#ifdef _WIN32
+#ifdef _MSC_VER
 	ofstream file( utf8_to_ucs2( m_level_filename ).c_str(), ios::out | ios::trunc );
 #else
 	ofstream file( m_level_filename.c_str(), ios::out | ios::trunc );

src/overworld/overworld.cpp

--- overworld.cpp.orig	2013-08-27 21:15:42 +0000
+++ overworld.cpp	2013-08-30 00:23:12 +0000
@@ -81,7 +81,7 @@
 	std::string filename = save_dir + "/description.xml";
 
 // fixme : Check if there is a more portable way f.e. with imbue()
-#ifdef _WIN32
+#ifdef _MSC_VER
 	ofstream file( utf8_to_ucs2( filename ).c_str(), ios::out | ios::trunc );
 #else
 	ofstream file( filename.c_str(), ios::out | ios::trunc );
@@ -319,7 +319,7 @@
 	std::string filename = save_dir + "/world.xml";
 
 // fixme : Check if there is a more portable way f.e. with imbue()
-#ifdef _WIN32
+#ifdef _MSC_VER
 	ofstream file( utf8_to_ucs2( filename ).c_str(), ios::out | ios::trunc );
 #else
 	ofstream file( filename.c_str(), ios::out | ios::trunc );

src/overworld/world_layer.cpp

--- world_layer.cpp.orig	2013-08-27 21:15:42 +0000
+++ world_layer.cpp	2013-08-30 00:23:19 +0000
@@ -349,7 +349,7 @@
 bool cLayer :: Save( const std::string &filename )
 {
 // fixme : Check if there is a more portable way f.e. with imbue()
-#ifdef _WIN32
+#ifdef _MSC_VER
 	ofstream file( utf8_to_ucs2( filename ).c_str(), ios::out | ios::trunc );
 #else
 	ofstream file( filename.c_str(), ios::out | ios::trunc );

src/user/preferences.cpp

--- preferences.cpp.orig	2013-08-27 21:15:42 +0000
+++ preferences.cpp	2013-08-30 00:24:33 +0000
@@ -168,7 +168,7 @@
 	Update();
 
 // fixme : Check if there is a more portable way f.e. with imbue()
-#ifdef _WIN32
+#ifdef _MSC_VER
 	ofstream file( utf8_to_ucs2( m_config_filename ).c_str(), ios::out | ios::trunc );
 #else
 	ofstream file( m_config_filename.c_str(), ios::out | ios::trunc );

src/user/savegame.cpp

--- savegame.cpp.orig	2013-08-27 21:15:42 +0000
+++ savegame.cpp	2013-08-30 00:24:42 +0000
@@ -590,7 +590,7 @@
 	Delete_File( m_savegame_dir + "/" + int_to_string( save_slot ) + ".save" );
 
 // fixme : Check if there is a more portable way f.e. with imbue()
-#ifdef _WIN32
+#ifdef _MSC_VER
 	ofstream file( utf8_to_ucs2( filename ).c_str(), ios::out | ios::trunc );
 #else
 	ofstream file( filename.c_str(), ios::out | ios::trunc );

Open SMC.cbp in Code::Blocks, then click Build. If all went well in the previous steps, wait a few minutes and you should have a shiny new SMC.exe file in C:\Dev\cpp\projects\SMC\bin\Debug.

In order to run it you'll need the following DLLs, which can be found in the appropriate subfolders under C:\MinGW\libs: CEGUIBase_d.dll, CEGUIExpatParser_d.dll, CEGUIFalagardWRBase_d.dll, CEGUINullRenderer_d.dll, CEGUIOpenGLRenderer_d.dll, CEGUISILLYImageCodec_d.dll, libboost_chrono-mgw46-mt-d-1_54.dll, libboost_filesystem-mgw46-mt-d-1_54.dll, libboost_system-mgw46-mt-d-1_54.dll, libboost_thread-mgw46-mt-d-1_54.dll, libFLAC-8.dll, libfreetype-6.dll, libjpeg-8.dll, libmikmod-2.dll, libogg-0.dll, libpng15-15.dll, libtiff-5.dll, libvorbis-0.dll, libvorbisfile-3.dll, libwebp-2.dll, SDL.dll, SDL_image.dll, SDL_mixer.dll, SDL_net.dll, SDL_ttf.dll, SILLY_d.dll, smpeg.dll, and zlib1.dll.

Do the same for Release and copy the appopriate DLLs.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox