Compiling on Windows using Microsoft Visual C++ 2005

From OpenTTD
Jump to: navigation, search

This article gets you started on compiling OpenTTD using Microsoft Visual C++ 2005 Express Edition.

Contents

Required software

Download these pieces of software. Then follow the installation instructions provided in this article.

  1. Microsoft Visual C++ 2005 Express Edition
  2. Microsoft® Windows® SDK
  3. Microsoft® DirectX® SDK August 2007
  4. openttd-useful.zip, a collection of files of varying age.
  5. TortoiseSVN
  6. The newest source from svn://svn.openttd.org/trunk; download with TortoiseSVN.

Note: This guide has been made on Windows XP with VTP applied. For Vista, see the guide for MSVC++ 2008 Express.

Alternative files

For the latest zlib, libpng and FreeType files you can browse their websites below.


While TortoiseSVN is great for SVN novices, some advanced developers prefer the command line SVN client:

Installation and setup

  • Install Microsoft Visual C++ 2005 Express Edition. This should be fairly easy. Download it, run it and drink a beer while waiting ;)
  • Install Microsoft Platform SDK. I recommend to install the same options way I did, so it won't use a lot of unnecessary space (see the images below).

Psdk custom1.png

Psdk custom2.png

Setting up includes and libraries

Now extract the Openttd-useful.zip file and copy:

  • The contents of the include folder to C:\Program Files\Microsoft Visual Studio 8\VC\include.
  • The contents of the library folder to C:\Program Files\Microsoft Visual Studio 8\VC\lib.

Setting up the DirectX SDK

Well, from the components screen remove the documentation and sample source code you'll save a lot of space (800+ MB). They're pretty useless if you just need to compile OpenTTD. Note:You should not use a version newer than August 2007 as DirectMusic is no longer supported as of the November 2007 release.

Setting up the VC++ Directories

Go to Tools -> Options, then to Projects and Solutions -> VC++ Directories. Add the following lines:

Executable files:

  • C:\Program Files\Microsoft Platform SDK\Bin

Include files:

  • C:\Program Files\Microsoft Platform SDK\Include
  • C:\Program Files\Microsoft DirectX SDK\Include

Library files:

  • C:\Program Files\Microsoft DirectX SDK\Lib\x86
  • C:\Program Files\Microsoft Platform SDK\Lib

Note: Please update the paths as necessary.


Msvc exe screen.png

Msvc include screen.png

Msvc lib screen.png


Only a few changes are required to use the Platform SDK with Visual C++ 2005 Express. Please follow steps 3, 4 and maybe 5 of the guide from Microsoft.

Compiling

Open projects/openttd_vs80.sln. This will open your IDE with the project loaded. If you want to compile a debug version straight ahead, press F7 and enjoy. To compile a non-debug version, go to Build -> Configuration Manager and select Release for OpenTTD. Press F7.

Personal tools