Compiling on DevCPlusPlus
From OpenTTD
Contents |
[edit] Introduction
This page contains guidelines for compiling OpenTTD in Win32 with MinGW and Dev-C++.
Note: this how to is outdated. Dev-C++ is currently not supported by OpenTTD.
[edit] Information
- Source tested: OTTD r1238.
- Packages used here:
- MSYS-1.0.10
- MinGW-3.1.0-1
- binutils-2.15.91-20040904-1
- gcc-core-3.4.2-20040916-1
- gcc-g++-3.4.2-20040916-1
- mingw-runtime-3.5
- w32api-3.1
- zlib-1.2.1
- DirectX9 for Dev-C++ from http://www.devlib-central.org/mambo/index.php?option=com_remository&Itemid=12&func=selectcat&cat=4 (FIXME this link is broken)
- Dev-C++-4.9.9.1 (with compiler)
- Others
- SDL will not be used here.
- SVN will not be used here, however it is recommended to have it.
[edit] Setting up Environment
- Set up MinGW and zlib. Please refer to Setting up MinGW and Compiling zlib.
- Install Dev-C++ from http://www.bloodshed.net/dev/index.html.
- Follow the instrutions on http://www.gamedev.net/reference/articles/article2067.asp to get DirectX (DirectMusic) to work.
[edit] Configure compiler
- Run Dev-C++.
- In Tools -> Compiler Options
- Add Compiler set "MinGW".
- In directories tab, remove all directories in all sessions. Just add (mingw)\bin in "Binaries". Change (mingw) into your MinGW installation.
- Click "OK".
[edit] Compiling strgen
You need tables/strings.h created by strgen to compile OpenTTD.
- Import ./strgen/strgen.dsp into Dev-C++.
- Press Ctrl+F9 to compile.
- Copy the newly created strgen.exe to the main directory where you installed the OpenTTD source.
- Run strgen.exe from there. It should create table/strings.h.
[edit] Compiling OTTD
If you cannot compile, DON'T PANIC. Sometimes it may be due to coding errors.
- Import the "ttd.dsp" to Dev-C++. Use "ttd - Win32 Release". Ignore the error about missing files.
- Wait for parsing.
- In Project -> Project Options.
- Under the Compiler tab, choose "MinGW" as compiler.
- Under the Parameters tab, add -DINITGUID to both the C and the C++ compiler options.
- Click "OK".
- Create Makefile.config by Execute -> Clean.
- Add Makefile.config the into project. Modify the file by changing the following parameters:
STATIC:=
WITH_ZLIB:=1
WITH_SDL:=
STATIC_ZLIB_PATH:=/mingw/lib/libz.a
WIN32:=1
UNIX:=
OSX:=
FREEBSD:=
MORPHOS:=
BEOS:=
SUNOS:=
CYGWIN:=
MINGW:=1- Some slots are made empty to disable.
- Compile the project.
- The compile was successful if you see a new
openttd.exefile appear in the folder.
[edit] Testing OTTD
- Copy the following files from
(TTD)\data\to(OTTD)\data\:sample.cat
trg1r.grf
trgcr.grf
trghr.grf
trgir.grf
trgtr.grf - Run
openttd.exe. - Enjoy!
