Darkvater@5659: Compiling OpenTTD using Microsoft Visual C++ Darkvater@5740: January 2, 2007 Darkvater@5659: -------------------------------------------- Darkvater@5659: PLEASE READ THE ENTIRE DOCUMENT BEFORE DOING ANY ACTUAL CHANGES!! darkvater@844: Darkvater@5740: Darkvater@5659: SUPPORTED MSVC COMPILERS Darkvater@5659: ------------------------ rubidium@8905: OpenTTD includes projects for MSVC 2005.NET and MSVC 2008.NET. Both will Darkvater@5659: compile out of the box, providing you have the required libraries/headers; rubidium@8905: which ones, see below. There is no support for VS6 or MSVC 2002, or rubidium@8905: MSVC 2003.NET. You are therefore strongly encouraged to either upgrade to rubidium@8905: MSVC 2005 Express (free) or use GCC. darkvater@844: Darkvater@5740: Darkvater@5659: 1) REQUIRED FILES Darkvater@5659: ----------------- Darkvater@5659: You might already have some of the files already installed, so check before Darkvater@5659: downloading; mostly because the DirectX SDK and Platform SDK are about Darkvater@5659: 500MB each. miham@940: Download the following files: darkvater@844: Darkvater@5659: * openttd-useful.zip (http://sf.net/project/showfiles.php?group_id=103924&package_id=114307) Darkvater@5659: * DirectX 8.1 SDK (http://neuron.tuke.sk/~mizanin/eng/Dx81sdk-include-lib.rar) (or alternatively the latest DirectX SDK from Microsoft) Darkvater@5659: * MS Windows Platform SDK (http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en) Darkvater@5659: * afxres.h (http://www-d0.fnal.gov/d0dist/dist/packages/d0ve/devel/windows/AFXRES.H) miham@940: Darkvater@2771: ...and of course the newest source from svn://svn.openttd.org/trunk miham@940: Darkvater@5659: You need an SVN-client to download the source from subversion: miham@940: Darkvater@5659: * CLI Subversion (http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91) Darkvater@5659: * GUI TortoiseSVN (http://tortoisesvn.tigris.org/download.html) miham@940: Darkvater@5740: Darkvater@5659: 2) INCLUDES AND LIBRARIES Darkvater@5659: ------------------------- Darkvater@5659: Put the newly downloaded files in the VC lib\ and include\ directories; where Darkvater@5659: "C:\Program Files\Microsoft Visual Studio 8\VC" is your location of Visual C. Darkvater@5659: If you are compiling for an x64 system, use the include\ and lib\ directories Darkvater@5659: from the win64/ folder. miham@940: Darkvater@5659: * openttd-useful.zip\include\* Darkvater@5659: * afxresh.h Darkvater@5659: to > C:\Program Files\Microsoft Visual Studio 8\VC\Include miham@940: Darkvater@5659: * openttd-useful.zip\lib\* Darkvater@5659: to > C:\Program Files\Microsoft Visual Studio 8\VC\Lib miham@940: Darkvater@5659: Custom directories might be recommended, check 2.2) miham@940: miham@940: Darkvater@5659: 2.1) INCLUDES AND LIBRARIES - DIRECTX/PLATFORM SDK Darkvater@5659: -------------------------------------------------- Darkvater@5659: Basically the same procedure as with the useful zip file, providing Darkvater@5659: you are not using the Microsoft installer. Put the include files in the Darkvater@5659: include\ directory and the library files to the Lib\ directory. miham@940: Darkvater@5659: It is recommended to use custom directories so you don't overwrite any Darkvater@5659: default header or library files. miham@940: Darkvater@5740: Darkvater@5659: 2.2) CUSTOM DIRECTORIES Darkvater@5659: ----------------------- Darkvater@5659: If you have put the above include and/or library files into custom folders, Darkvater@5659: MSVC will not find them by default. You need to add these paths to VC through: miham@940: Darkvater@5659: Tools > Options > Projects and Solutions > VC++ Directories > show directories for miham@940: Darkvater@5659: * Include files: Add the DirectX/Platform SDK include dir you've created Darkvater@5659: * Library files: Add the path to the SDK custom lib dir Darkvater@5659: Darkvater@5659: NOTE: make sure that the directory for the DirectX SDK is the first one in the Darkvater@5659: list, above all others, otherwise compilation will most likely fail!! Darkvater@5659: Darkvater@5740: Darkvater@5659: 3) TTD GRAPHICS FILES Darkvater@5659: --------------------- Darkvater@5740: Copy the following files from Transport Tycoon Deluxe to the bin/data folder miham@940: Darkvater@5659: * sample.cat Darkvater@5659: * trg1r.grf Darkvater@5659: * trgcr.grf Darkvater@5659: * trghr.grf Darkvater@5659: * trgir.grf Darkvater@5659: * trgtr.grf miham@940: miham@940: Darkvater@5659: 4) COMPILING Darkvater@5659: ------------ rubidium@8905: Open trunk/openttd_vs[89]0.sln Darkvater@5659: Set the build mode to 'Release' in Darkvater@5659: Build > Configuration manager > Active solution configuration > select "Release" miham@940: Compile... miham@940: rubidium@8905: If everything works well the binary should be in trunk/objs/Win[32|64]/Release/openttd.exe Darkvater@5740: Darkvater@2771: Darkvater@5659: 5) EDITING, CHANGING SOURCE CODE Darkvater@5659: -------------------------------- Darkvater@5659: Set the build mode (back to) 'Debug' Darkvater@5659: Change the startup project to openttd by right-clicking the 'openttd' project Darkvater@5659: in the Solution Explorer and selecting 'Set as Startup Project'. The 'openttd' Darkvater@5659: project should now show up bold instead of 'strgen'. darkvater@844: Darkvater@5740: Darkvater@5659: 6) PROBLEMS? Darkvater@5659: ------------ Darkvater@5659: If compilation fails, double-check that you are using the latest SVN (!) Darkvater@5659: source. If it still doesn't work, check in on IRC (irc://irc.oftc.net/openttd), Darkvater@5659: to ask about reasons; or just wait. The problem will most likely solve itself Darkvater@5659: within a few days as the problem is noticed and fixed. darkvater@844: Darkvater@5659: An up-to-date version of this README can be found on the wiki: rubidium@8905: http://wiki.openttd.org/index.php/MicrosoftVisualCExpress