A while ago, when I finally managed to compile DROD for myself, I said that I'd get round to writing a guide for other people to follow, and here it is.
The following is a guide to compiling DROD on windows using Dev C++:
1) Download Dev C++ Version 5 beta from
here.
2) Install Dev C++ selecting the 'Full Install' option.
3) Download the latest DROD source code from
here.
4) Extract the DROD source zip file.
From this point on I will assume that Dev C++ is installed in C:\Dev-Cpp and the DROD source unzipped to C:\DROD so you may need to change file names that I mention later to match where the two are located on your computer.
5) In Dev C++ go to the tools option and select 'Check for Updates/Packages...'. Now select the 'devpaks.org Community Devpaks' server and check for updates. Then download and install the following:
SDL 1.2.11
SDL_ttf 2.0.
8
zlib 1.2.3
libcurl 7.14.0_nossl
(7.15.2 is the one being used now)
Expat 2.0.0
FMOD 3.7
5
libjpeg 6b-4
libpng 1.2.8
(1.2.12 is being used now)
WebUpdateMirrorsList
NB: The versions of the libraries used by DROD are not all available for download through Dev C++. It is possible to find the appropriate versions by a quick search of the internet. On the other hand, as far as I know, using the slightly older versions that can be downloaded through Dev C++ does not cause any problems.
6) Now select the 'Dev-C++ primary devpak server' and download and install 'MinGW runtime'.
7) Now download the file attached to this post which contains various bits of the metakit library that we require. Decompress the file and put mk4.h and mk4.inl in C:\Dev-Cpp\include and libmk4.a in C:\Dev-Cpp\lib.
8) In Dev C++ select the 'file' menu then select 'new' and create a new project. Select the empty project option and name the project DROD.
9) Right click on your DROD project, which should now have appeared in a panel on the left of the screen, and create the following new folders:
BackEndLib
DROD
DRODLib
FrontEndLib
10) Right click on each folder, select 'Add to project' and add all the source files (.cpp and .h) from the appropriately named folder in C:\DROD\DROD20Source. However there is one exception, we don't want to add 'Copy of Sound.cpp' from FrontEndLib.
11) Now go to the 'Project' menu and select 'Project Options'. Under the 'General' tab in the icon section add the icon at C:\DROD\DROD20Source\DROD\Res\drod.ico. You also need to set the project type to 'Win32 GUI'.
12) Under the 'Parameters' tab add “-D__GNUWIN32__ -W -fexceptions -DUNICODE -DNDEBUG -DWIN32 -D_WINDOWS -D_MBCS -Dmain=SDL_main” (bubt without the quotes) to the compiler and c++ compiler command line options. Then add “-lmingw32 -lSDLmain -lSDL -luser32 -lshell32 -lSDL_ttf -ljpeg –lpng –lexpat –lmk4 –lcurldll –lz –lfmod” (again without the quotes) to the linker options.
13) Under the 'Directories' tab add the folders C:\Dev-Cpp\include\SDL, C:\Dev-Cpp\include\FMOD and C:\DROD\DROD20Source to the include directories and C:\DROD\DROD20Source\DROD\Res to the resource directories.
Now you're nearly ready to compile DROD but we need to make a few changes to the source code first.
14) In BackEndLib\Assert.h find the lines:
# define ASSERT(exp) _ASSERT_VOID_CAST( (exp) ? 0 : AssertErr(__FILE__,__LINE__,#exp) )
# define ASSERTP(exp, desc) _ASSERT_VOID_CAST( (exp) ? 0 : AssertErr(__FILE__,__LINE__,(desc)) )
and change them to:
# define ASSERT(exp) _ASSERT_VOID_CAST( (exp) ? (void) 0 : AssertErr(__FILE__,__LINE__,#exp) )
# define ASSERTP(exp, desc) _ASSERT_VOID_CAST( (exp) ? (void) 0 : AssertErr(__FILE__,__LINE__,(desc)) )
and in BackEndLib\Wchar.h change the line:
typedef WCHAR_t WCHAR; //wc, 16-bit UNICODE character
to:
typedef wchar_t WCHAR; //wc, 16-bit UNICODE character
15) Now there's just one thing left to change, wherever something of the form {{'E'},{'x'},{'a'},{'m'},{p'},{'l'},{'e'},{0}} appears in the code we need to replace it with {'E','x','a','m',p','l','e',0}. Unfortunately I know of no quick and easy way of doing this so it's time to compile DROD and replace these whenever we encounter them.
16) Press Ctrl + F9 or the compile button to start compiling DROD. Whenever you encounter an error of the form “brace-enclosed initializer used to initialize `const WCHAR'”, which hopefully will be the only errors you encounter, then simply double click on the error (they appear in the compiler output at the bottom of the window) and change the offending code. Then press Ctrl + F9 or the compile button to continue.
NB: Whilst compiling you will encounter warnings in the compiler output but it is safe, I think, to ignore these.
17) Now hopefully we have a freshly compiled DROD.exe in the same folder as you saved the project and all we need to do is put it in a suitable location so it can run. I suggest making a copy of your current DROD directory and simply replacing the executable. Due to the libraries that we compiled with your new DROD.exe requires different .dlls from the ones you already have. It does not need the following:
mk4vc60.dll
libexpat.dll
but does need:
jpeg62.dll
libpng13.dll
zlib1.dll
Click on the above links to download the files.
If nothing's gone wrong then you should be able to start your new executable and be greated by a fully functioning DROD. If you have any problems following the above instructions then feel free to post here and quiz me about them.
Andy
____________________________
"
True perfection has to be imperfect"
[Last edited by Andy101 at 09-16-2006 12:22 PM : Added note about 3rd party libs]