Difference between revisions of "Compiler Choices"

From Valve Developer Community
Jump to: navigation, search
(Updated to be significately more current)
Line 1: Line 1:
 
[[Category:Source_SDK_FAQ]]
 
[[Category:Source_SDK_FAQ]]
The SDK is set up to be compiled with Microsoft Visual C++ .NET 2003 v7.1 (No longer available for purchase from Microsoft as Visual Studio 2005 went live somewhere around November).
+
The SDK is set up to be compiled with [http://msdn.microsoft.com/howtobuy/visualc/default.aspx Visual Studio 2005], [http://msdn.microsoft.com/vstudio/express/visualc/ Visual C++ Express], or gcc (see [[Talk:Compiler_Choices|Talk]] Page).
  
http://msdn.microsoft.com/howtobuy/visualc/default.aspx.
+
Students of [http://msdn2.microsoft.com/en-us/academic/default.aspx MSDN Academic Alliance] Member Schools may qualify for discounted Visual Studio media.
 
 
This solution is, however, commercial and requires you to spend money to develop a modification for the Source-engine.  You can usually get it secondhand for around the price of two or three games.
 
 
 
From 1 November 2006, project and solution files for Visual Studio 2005 and Visual C++ Express editions are provided with the SDK.  See [[Source_SDK_Release_Notes]] and [[Compiling under VS2005]].
 
  
 
== Using other compilers ==
 
== Using other compilers ==
 
There is an Academic version of VS2003.NET available to students or faculty enrolled in college, which has an MSRP of $99. It IS legal to distribute content created with this version, however if Microsoft find out that you're not a student, they will most likely try to put an end to it.
 
 
The SDK can also be compiled under the older Microsoft Visual Studio 2002 product.  Most HL1 mods were made using this older version of C++, so if you're a modder, you may already have it installed.  If not, VS2002 may be cheaper to buy than VS2003.NET.  VS2002 users see [[Compiling under VS2002]].
 
  
 
:Q: The thought occurs that if the SDK can be tweaked to compile on an older version of VS, maybe it could also be tweaked to compile using Dev-C++ or another free compiler.  Has anyone ever tried this?  How can I do it? Or is it impossible?
 
:Q: The thought occurs that if the SDK can be tweaked to compile on an older version of VS, maybe it could also be tweaked to compile using Dev-C++ or another free compiler.  Has anyone ever tried this?  How can I do it? Or is it impossible?
  
 
::A: Dev-C++ is an IDE. The default compiler it uses is called [http://www.mingw.org MinGW], which is a Windows port of GCC (the more-or-less standard Linux compiler). Attempts to compile the SDK using MinGW have failed. Getting it to succeed would require a non-trivial amount of work.
 
::A: Dev-C++ is an IDE. The default compiler it uses is called [http://www.mingw.org MinGW], which is a Windows port of GCC (the more-or-less standard Linux compiler). Attempts to compile the SDK using MinGW have failed. Getting it to succeed would require a non-trivial amount of work.
 
Slightly more promising would be using the [http://msdn.microsoft.com/visualc/vctoolkit2003/ Visual C++ Toolkit], which is free and has the Visual C++ compiler and linker. It can't, however, parse Visual Studio solution files, getting around which is a non-trivial task. The advantage is that getting the SDK working with MinGW requires re-writing a surprisingly large number of sections of code, while the VC++ Toolkit merely needs to have a batch file/makefile written for it.
 
  
 
Another solution is to use a [http://www.vinoisnotouzo.com/hl2sdk-cmake/ port of the SDK] to [http://www.cmake.org/ CMake]. CMake is a cross-platform makefile and project file generator, and will generate Visual Studio project files for 6.0 2002 and 2003, and also NMake makefiles for the Visual C++ Toolkit. It can also generate GNUmake files for compiling under GCC. It may also assist any porting to MinGW.
 
Another solution is to use a [http://www.vinoisnotouzo.com/hl2sdk-cmake/ port of the SDK] to [http://www.cmake.org/ CMake]. CMake is a cross-platform makefile and project file generator, and will generate Visual Studio project files for 6.0 2002 and 2003, and also NMake makefiles for the Visual C++ Toolkit. It can also generate GNUmake files for compiling under GCC. It may also assist any porting to MinGW.
 
You can compile with Visual C++ 6 too ([[Microsoft Visual Studio 6.0 Usage]]).
 

Revision as of 00:24, 5 October 2007

The SDK is set up to be compiled with Visual Studio 2005, Visual C++ Express, or gcc (see Talk Page).

Students of MSDN Academic Alliance Member Schools may qualify for discounted Visual Studio media.

Using other compilers

Q: The thought occurs that if the SDK can be tweaked to compile on an older version of VS, maybe it could also be tweaked to compile using Dev-C++ or another free compiler. Has anyone ever tried this? How can I do it? Or is it impossible?
A: Dev-C++ is an IDE. The default compiler it uses is called MinGW, which is a Windows port of GCC (the more-or-less standard Linux compiler). Attempts to compile the SDK using MinGW have failed. Getting it to succeed would require a non-trivial amount of work.

Another solution is to use a port of the SDK to CMake. CMake is a cross-platform makefile and project file generator, and will generate Visual Studio project files for 6.0 2002 and 2003, and also NMake makefiles for the Visual C++ Toolkit. It can also generate GNUmake files for compiling under GCC. It may also assist any porting to MinGW.