Compiling on DevCPlusPlus

From OpenTTD

Jump to: navigation, search



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

[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

  1. Run Dev-C++.
  2. 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.

  1. Import ./strgen/strgen.dsp into Dev-C++.
  2. Press Ctrl+F9 to compile.
  3. Copy the newly created strgen.exe to the main directory where you installed the OpenTTD source.
  4. 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.

  1. Import the "ttd.dsp" to Dev-C++. Use "ttd - Win32 Release". Ignore the error about missing files.
  2. Wait for parsing.
  3. 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".
  4. Create Makefile.config by Execute -> Clean.
  5. 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.
  6. Compile the project.
  7. The compile was successful if you see a new openttd.exe file appear in the folder.


[edit] Testing OTTD

  1. Copy the following files from (TTD)\data\ to (OTTD)\data\:
    sample.cat
    trg1r.grf
    trgcr.grf
    trghr.grf
    trgir.grf
    trgtr.grf
  2. Run openttd.exe.
  3. Enjoy!
Personal tools