Compiling on Windows using Microsoft Visual C++ 2005
This article gets you started on compiling OpenTTD using Microsoft Visual C++ 2005 Express Edition.
Download these pieces of software. Then follow the installation instructions provided in this article.
- Microsoft Visual C++ 2005 Express Edition
- Microsoft® Windows® SDK
- Microsoft® DirectX® SDK August 2007
- openttd-useful.zip, a collection of files of varying age.
- 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.
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).
Setting up includes and libraries
Now extract the Openttd-useful.zip file and copy:
- The contents of the
C:\Program Files\Microsoft Visual Studio 8\VC\include.
- The contents of the
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
Tools -> Options, then to
Projects and Solutions -> VC++ Directories. Add the following lines:
- C:\Program Files\Microsoft Platform SDK\Bin
- C:\Program Files\Microsoft Platform SDK\Include
- C:\Program Files\Microsoft DirectX SDK\Include
- C:\Program Files\Microsoft DirectX SDK\Lib\x86
- C:\Program Files\Microsoft Platform SDK\Lib
Note: Please update the paths as necessary.
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.
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