Jump to content

Compiling Zandronum with Visual Studio: Difference between revisions

Remove the VS2005 build guide. It no longer works given Zan's recent dependency on C++11
mNo edit summary
(Remove the VS2005 build guide. It no longer works given Zan's recent dependency on C++11)
Line 90: Line 90:
Only available with the keyboard drivers from [http://www.logitech.com/ Logitech] hardware.
Only available with the keyboard drivers from [http://www.logitech.com/ Logitech] hardware.


= Using Visual Studio 2005 - 2015 =
= Build using Visual Studio 2015 or higher =
== Prerequisites ==
== Prerequisites ==
=== Visual Studio ===
=== Visual Studio ===
Line 128: Line 128:
Once successfully compiled, <code>zandronum.exe</code> will be in the <code>Debug</code> folder in the project directory.
Once successfully compiled, <code>zandronum.exe</code> will be in the <code>Debug</code> folder in the project directory.
<code>zandronum.pk3</code> will be in the project directory.
<code>zandronum.pk3</code> will be in the project directory.
= Using Visual Studio 2005 =
[[Image:VisualStudio2005.png|thumb|right|Zandronum's Source Code in Microsoft Visual Studio C++ 2005]]
== Prerequisites ==
=== Microsoft Visual Studio C++ 2005 Express Edition ===
Download: http://go.microsoft.com/fwlink/?linkid=57034
Version 2005 is recommended, including the necessary [http://msdn.microsoft.com/en-us/vstudio/aa948853.aspx updates]. The easiest way to install is to extract the <tt>VC.iso</tt> file using 7-zip to a directory and run <tt>setup.exe</tt>.
On Windows Vista and older:
*[http://www.microsoft.com/en-us/download/details.aspx?id=804 VS C++ 2005 (Express Editions) - Service Pack 1]
*[http://www.microsoft.com/en-us/download/details.aspx?id=7524 VS 2005 Service Pack 1 Update for Windows 6 Foundation(Vista/Windows7/etc.)]
It is possible to compile the project using more recent versions of Visual Studio, but these binaries may not be compatible with older Windows systems.
=== SQLite ===
Download the ZIP archive containing the amalgamation of SQLite version 3.8.10.1 [https://www.sqlite.org/2015/sqlite-amalgamation-3081001.zip here], extract the files <code>sqlite3.c</code>, <code>sqlite3.h</code> and <code>sqlite3ext.h</code> from the archive and put them into the sqlite directory of the Zandronum source.
== Configuring Visual Studio ==
[[Image:VisualStudio2005DirSetup.png|thumb|right|Directory Setup in Microsoft Visual Studio C++ 2005]]
In order to compile the Zandronum project, we must first include several items of dependencies.  Go to <u title="Tools - Options - Projects and Solutions - VC++ Directories">VC++ Directories</u> settings, and do the following:
=== Executable Files ===
Add the following executables:
==== NASM ====
:Typically the same location that the archive file was extracted from.  For example: <tt>C:\NASM\</tt>
=== Includes ===
[[Image:VisualStudio2005DirSetup_Includes.png|thumb|right|Directory Setup in Microsoft Visual Studio C++ 2005]]
Add the following to the Includes:
==== <code>$(DXSDK_DIR)Include</code> ====
:This is the DirectX SDK.  The code above translates to an Environment Variable.
==== FMOD Ex ====
:FMOD Ex can typically be located at: <code>C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\inc\</code>
==== OpenGL Header files ====
:This can be located at any directory placed.
==== OpenSSL ====
:Within the OpenSSL directory (where the contents were extracted and [[Compiling_Zandronum_on_Visual_Studio#OpenSSL | installed]]), the 'include' directory will be needed.
::Example: <code>C:\OpenSSL\Include</code>
=== Library Files ===
[[Image:VisualStudio2005DirSetup_Library.png|thumb|right|Directory Setup in Microsoft Visual Studio C++ 2005]]
Add the following to the 'Library' list:
==== <code>$(DXSDK_DIR)Lib\x86</code> ====
:This, again, is the DirectX SDK environment variable with a location directory included.
==== FMOD Ex Library ====
:This is typically located at: <code>C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\lib</code>
==== Logitech LCD SDK ====
:This is typically located in archive file (if G15 drivers installed): <code>C:\Program Files\Logitech Gaming Software\LCDSDK\LCDSDK_(VERSION).zip</code>
:If installed without the drivers, place the correct path to 'lglcd.lib' in the path.
==== OpenSSL ====
:Within the OpenSSL directory (where the contents were extracted and [[Compiling_Zandronum_on_Visual_Studio#OpenSSL | installed]]), the 'lib' directory will be needed.
::Example: <code>C:\OpenSSL\lib</code>
== Compiling the Project ==
Before you compile the project make sure you do not have <tt>Debug DLL</tt> selected near the top middle of the main screen of Visual C++ 2005. It should be set to <tt>Release</tt>. This is in a dropdown menu most likely beneath the 'Community' and 'Windows' tab at the top.
To compile the project, go to: '''Build''' and then '''Build Solution'''


= Troubleshooting =
= Troubleshooting =
== Cannot find Windows.h or WinSock2.h (and probably many more errors) ==
Sometimes upon installation of the SDK, it will not properly update the path that VC 2005+ automatically comes with. Therefore you have to manually add the fix in your <u title="Tools - Options - Projects and Solutions - VC++ Directories">VC++ Directories</u> under "Includes" by manually adding the path to the Windows include folder.
This is an example of what you may have to add to fix the problem:
<code>C:\Program Files\Microsoft SDKs\Windows\v7.0\Include</code>
== Cannot find gdi32.lib (or [name].lib) ==
Like the above, sometimes upon installation of the SDK... it will not properly update the path that VC 2005+ automatically comes with. Therefore you have to manually add the fix in your <u title="Tools - Options - Projects and Solutions - VC++ Directories">VC++ Directories</u> under "Libraries" by manually adding the path to the Windows library folder.
This is an example of what you may have to add to fix the problem:
<code>C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib</code>
== OpenGL (_interlockedbittestandset) Issue ==
You will want to comment out the lines at intrin.h, it's location can be found most likely at this location:
<code>C:\Program Files\Microsoft Visual Studio 8\VC\include</code>
The code would look as follows (add the slashes before to fix the problem):
  ...
  //__MACHINEI(unsigned char _interlockedbittestandset(long *a, long b))
  //__MACHINEI(unsigned char _interlockedbittestandreset(long *a, long b))
  ...
== Cannot find GL/glext.h ==
That means you have to place your GL files in your SDK directory like so:
<code>C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\gl</code>
== 'Cr0NpxState' : is not a member of _FLOATING_SAVE_AREA ==
== 'Cr0NpxState' : is not a member of _FLOATING_SAVE_AREA ==