docs/Readme_Windows_MSVC.txt
author rubidium
Sat, 30 Dec 2006 00:46:48 +0000
changeset 5428 00fab4aeff78
parent 5408 8cbe4c5e4a8b
child 5489 54e5b9d2594a
permissions -rw-r--r--
(svn r7632) -Codechange: several small code cleanups of texteff, like moving magic values and defines to an enum and fix coding/documentation style.
-Codechange: make DeleteAnimatedTile a little clearer (pv2b).
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
     1
Compiling OpenTTD using Microsoft Visual C++
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
     2
December 28, 2006
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
     3
--------------------------------------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
     4
PLEASE READ THE ENTIRE DOCUMENT BEFORE DOING ANY ACTUAL CHANGES!!
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
     5
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
     6
SUPPORTED MSVC COMPILERS
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
     7
------------------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
     8
OpenTTD includes projects for MSVC 2003.NET and MSVC 2005.NET. Both will
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
     9
compile out of the box, providing you have the required libraries/headers;
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    10
which ones, see below. There is no support for VS6, you are therefore
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    11
strongly encouraged to either upgrade to MSVC 2005 Express (free) or use GCC.
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    12
MSVC 2002 probably works as well, but it has not been tested.
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    13
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    14
1) REQUIRED FILES
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    15
-----------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    16
You might already have some of the files already installed, so check before
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    17
downloading; mostly because the DirectX SDK and Platform SDK are about
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    18
500MB each.
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    19
Download the following files:
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    20
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    21
	* openttd-useful.zip (http://sf.net/project/showfiles.php?group_id=103924&package_id=114307)
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    22
	* DirectX 8.1 SDK (http://neuron.tuke.sk/~mizanin/eng/Dx81sdk-include-lib.rar) (or alternatively the latest DirectX SDK from Microsoft)
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    23
	* MS Windows Platform SDK (http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en)
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    24
	* afxres.h (http://www-d0.fnal.gov/d0dist/dist/packages/d0ve/devel/windows/AFXRES.H)
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    25
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    26
...and of course the newest source from svn://svn.openttd.org/trunk
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    27
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    28
You need an SVN-client to download the source from subversion:
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    29
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    30
	* CLI Subversion (http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91)
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    31
	* GUI TortoiseSVN (http://tortoisesvn.tigris.org/download.html)
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    32
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    33
2) INCLUDES AND LIBRARIES
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    34
-------------------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    35
Put the newly downloaded files in the VC lib\ and include\ directories; where
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    36
"C:\Program Files\Microsoft Visual Studio 8\VC" is your location of Visual C.
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    37
If you are compiling for an x64 system, use the include\ and lib\ directories
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    38
from the win64/ folder.
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    39
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    40
	* openttd-useful.zip\include\*
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    41
	* afxresh.h
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    42
	to >	C:\Program Files\Microsoft Visual Studio 8\VC\Include
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    43
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    44
	* openttd-useful.zip\lib\*
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    45
	to >	C:\Program Files\Microsoft Visual Studio 8\VC\Lib
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    46
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    47
Custom directories might be recommended, check 2.2)
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    48
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    49
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    50
2.1) INCLUDES AND LIBRARIES - DIRECTX/PLATFORM SDK
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    51
--------------------------------------------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    52
Basically the same procedure as with the useful zip file, providing
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    53
you are not using the Microsoft installer. Put the include files in the
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    54
include\ directory and the library files to the Lib\ directory.
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    55
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    56
It is recommended to use custom directories so you don't overwrite any
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    57
default header or library files.
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    58
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    59
2.2) CUSTOM DIRECTORIES
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    60
-----------------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    61
If you have put the above include and/or library files into custom folders,
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    62
MSVC will not find them by default. You need to add these paths to VC through:
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    63
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    64
Tools > Options > Projects and Solutions > VC++ Directories > show directories for
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    65
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    66
	* Include files: Add the DirectX/Platform SDK include dir you've created
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    67
	* Library files: Add the path to the SDK custom lib dir
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    68
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    69
NOTE: make sure that the directory for the DirectX SDK is the first one in the
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    70
list, above all others, otherwise compilation will most likely fail!!
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    71
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    72
3) TTD GRAPHICS FILES
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    73
---------------------
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    74
Copy the following files from Transport Tycoon Deluxe to the data folder
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    75
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    76
	* sample.cat
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    77
	* trg1r.grf
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    78
	* trgcr.grf
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    79
	* trghr.grf
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    80
	* trgir.grf
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    81
	* trgtr.grf
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    82
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    83
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    84
4) COMPILING
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    85
------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    86
Open trunk/openttd[_vs80].sln
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    87
Set the build mode to 'Release' in
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    88
Build > Configuration manager > Active solution configuration > select "Release"
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    89
Compile...
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    90
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    91
If everything works well the binary should be in trunk/Release/openttd.exe
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    92
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    93
5) EDITING, CHANGING SOURCE CODE
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    94
--------------------------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    95
Set the build mode (back to) 'Debug'
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    96
Change the startup project to openttd by right-clicking the 'openttd' project
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    97
in the Solution Explorer and selecting 'Set as Startup Project'. The 'openttd'
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
    98
project should now show up bold instead of 'strgen'.
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
    99
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
   100
6) PROBLEMS?
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
   101
------------
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
   102
If compilation fails, double-check that you are using the latest SVN (!)
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
   103
source. If it still doesn't work, check in on IRC (irc://irc.oftc.net/openttd),
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
   104
to ask about reasons; or just wait. The problem will most likely solve itself
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
   105
within a few days as the problem is noticed and fixed.
5355
195bce6def67 (svn r7527) -Update appropiate files with release information for 0.5.0-RC1
Darkvater
parents:
diff changeset
   106
5408
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
   107
An up-to-date version of this README can be found on the wiki:
8cbe4c5e4a8b (svn r7605) -Update documentation of MSVC and strgen in docs/ dir and remove directmusic.txt
Darkvater
parents: 5355
diff changeset
   108
http://wiki.openttd.org/index.php/MicrosoftVisualCExpress