Last modified 15 months ago Last modified on 02/26/11 04:31:59

Windows Compile Guide (MSVC)

NOTE: This is highly out of date! If you are using VS2k10, you *MUST* compile all the libs yourself.

NOTE: This is important, you *must* have these defined for VS2k10 (preprocessor definitions):

_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;YY_NO_UNISTD_H\;LOCALEDIR=\"\";YY_STATIC;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0 

NOTE: If you want acceptable performance, use STLport.

This will guide you through the steps necessary to compile Warzone on Windows using Microsoft Visual C++. Alternatively, there is a guide dedicated to compiling with MinGW, the Windows Compile Guide (MinGW).

Prerequesites

Downloading the sourcecode

  • Create a directory where you want to store the Warzone sourcecode. You will need the path to the sourcecode, so remember it's location!
  • Right-click on it and choose “SVN Checkout…”
  • Set “URL of repository” to https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk, leave everything else as is and click OK.
  • TortoiseSVN will now checkout the current sourcecode from our SVN repository. This may take a while, especially on slow internet connections.

Preparing

  1. Extract the Developer's Package into the directory where you have the Warzone 2100 sourcecode, right where the src\, data\, win32\ and other directories are. Note: You will find a "devpkg" folder in the package, this will be a new folder in the root directory of the Warzone 2100 sourcecode folder. "Data" folder should be merged with the same folder in Warzone 2100 root directory.
  2. Open the Solution “Warzone2100.sln” in win32\ folder if you're using MSVC 2005 or open the Solution “Warzone2100.vs2k8.sln” in win32\ folder if you're using MSVC 2008 or later (Some of the common project were created using MSVC 2005, so a one-time conversion will be required).
  3. Your environment PATH variable should include the “<path to GnuWin32>\bin” directory. This should be where your bison.exe, flex.exe and gettext files were installed.
  4. Under Properties –> Debugging –> Set your additional command line arguments. At a minimum you should specify the data directory using the --datadir commandline option. For e. g. --datadir D:\Programming\Warzone2100\data. You also should specify this directory as working directory.
  5. Select "Warzone2100" as start object.

Updating the %PATH%

In order for Flex/Bison to work fine, you will need to add some directories %PATH% environment variable. In Windows 2000 and later you do this by right clicking "My Computer" then select "Properties" -> "Advanced" -> "Environment variables". Now in the sub-box called "System variables" you should select "PATH" (or "Path"), click "Edit" (or "Modify" ?) and at the end of that line add ";C:\Program Files\GnuWin32\bin" (assuming you installed Bison/Flex in "C:\Program Files\GnuWin32"). The final path will then look like this (note the absence of the "double quotes"):

C:\WINDOWS\system32;C:\Windows;C:\Program Files\GnuWin32\bin

Compile

Choose “Build / Solution” from the menu.

Troubleshooting

  • Some people report that the following could help if bison generates errors: Under Build -> Batch build... -> Mark all -> Build.
  • If you encounter an error about some missing lib try checking for newer devpkg.
  • Feel free to ask for help on our forum.

Final steps

Take a look at the Coding section.