Difference between revisions of "Source SDK 2013"

From Valve Developer Community
Jump to: navigation, search
(vgui_controls Doesn't Compile)
m (Added information about problem "unresolved symbol _IID_IspPhoneticAlphabetSelection" (translated from https://developer.valvesoftware.com/wiki/Source_SDK_2013:es))
 
(203 intermediate revisions by 43 users not shown)
Line 1: Line 1:
 
{{otherlang2
 
{{otherlang2
 
|title=Source SDK 2013
 
|title=Source SDK 2013
|ru=Source SDK 2013:ru}}{{toc-right}}
+
|ru=Source SDK 2013:ru|es=Source SDK 2013:es|zh-cn=Source SDK 2013:zh-cn|ko=Source SDK 2013:ko}}
 +
{{cleanup|OS X instructions are incomplete, the files cannot be possibly built due to the Windows dependencies, they need to be re-written from scratch. Shader build instructions are poorly written, not crossplatform friendly. Valve Project Creator instructions are incomplete.}}{{toc-right}}
  
To get started, you will need to grab the source code from the [https://github.com/ValveSoftware/source-sdk-2013 Valve Software Source SDK repository] on GitHub. Then you will be able to build the software and then build great and wonderful mods!
+
'''Key points'''
 +
{{Note|The Source SDK uses the [[Valve Project Creator|Valve Project Creator]] in order to generate the required platform specific files.}}
 +
{{Note|If you want to create a simple, content-based mod, see [https://www.moddb.com/company/source-forever/downloads/source-sdk-2013-singleplayer-mod-template this fully-compiled template.]}}
 +
{{Note|You can always edit code files with [http://notepad-plus-plus.org Notepad ++] or a similar program, and then compile under Visual Studio.}}
  
=Obtaining the Code=
+
=Setting Up (All Platforms)=
'''GitHub''' provides a number of ways to obtain and update the code. Here's a review of the main ways to get the code, but [https://help.github.com/ GitHub Help] is a great resource to learn more about using [http://git-scm.com/ Git] and the added features of [https://github.com GitHub].
 
  
==Via Repository==
+
==Setting up the Source SDK Base==
The easiest way to keep updated on the latest released code is to use Git to obtain the repository. Git itself is a CLI for all platforms, but GitHub also provides installers that install both the CLI version and a GUI to help manage your repositories.
+
Install Source SDK Base 2013 (multiplayer or singleplayer depending on your mod) from Steam->Library->Tools or from the links below:
  
===GitHub Client (Windows & Mac)===
+
* [steam://rungameid/243730 Install Source SDK Base 2013 (SP) Singleplayer] (AppID: 243730)
 +
* [steam://rungameid/243750 Install Source SDK Base 2013 (MP) Multiplayer] (AppID: 243750)
  
# Obtain the GitHub client.
+
==Getting the code==
#* [http://github-windows.s3.amazonaws.com/GitHubSetup.exe Windows]
 
#* [https://central.github.com/mac/latest Mac OS X]
 
# Install the GitHub client.
 
# Visit the [https://github.com/ValveSoftware/source-sdk-2013 Source SDK 2013 repository] in your browser and click the "Clone in Desktop" button.
 
#* This will open the GitHub client. Follow the instructions to clone the desktop onto your computer.
 
  
When you wish to update the code, you may do so by hitting the "Sync" or "Sync Branch" button in the repository.
+
===Method one: Using the GitHub Desktop client (Windows/OS X)===
  
===Git CLI (All Platforms)===
+
# Download and install the [https://desktop.github.com/ GitHub Desktop] client
 +
# Open the [https://github.com/ValveSoftware/source-sdk-2013 Source SDK git repo] and click "Clone to desktop"
  
Detailed instructions on how to set up Git on any platform, including updating the repository, [https://help.github.com/articles/set-up-git are provided by GitHub].
+
===Method two: Using the command line (Windows/OS X/Linux)===
  
With the CLI installed, you can obtain the code using a line similar to this:
+
# Download and install the git CLI. Linux users can download it with their distro's package manager (APT, Aptitude, DNF, Pacman, Synaptic...). Mac's users can download git [https://git-scm.com/downloads here].
 +
# Open the terminal/command prompt and run this command:
  
> git clone '''git@github.com:ValveSoftware/source-sdk-2013.git'''
+
<pre>git clone https://github.com/ValveSoftware/source-sdk-2013.git</pre>
  
==Via Download==
+
===Method three: Downloading the ZIP archive===
You may also download a ZIP bundle. This will give you the latest release, but you will need to manually download and update the code. If you also plan on contributing code back to the repository, you will need to follow the above Git instructions with a separate instance of your local files.
 
  
# Visit the [https://github.com/ValveSoftware/source-sdk-2013 Source SDK 2013 repository] in your browser.
+
{{Note|Note: You will need to update the code manually whenever changes are committed to the repo}}
# Click the "Download ZIP" button.
+
Download from [https://github.com/ValveSoftware/source-sdk-2013/archive/master.zip here]
  
=Platform Specific Build Instructions=
+
=Setting up (Platform Specific)=
 +
==Source SDK 2013 on Windows==
  
== Creating Project & Makefiles ==
+
===Step One: Installing Visual Studio===
 +
{{Note|Although Source SDK 2013 currently does '''NOT''' compile with Visual Studio 2015 ([https://github.com/ValveSoftware/source-sdk-2013/issues/325 bug report]) you can still use VS 2015 as IDE and compile the code with the VS 2013 toolset.<br />
 +
Just install both VS 2013 and 2015, open the solution in VS 2015, and skip the dialog where VS 2015 tries to upgrade your projects.}}
 +
You can also compile without Visual Studio, or using a different version.
  
The 2013 SDK uses the [[Valve Project Creator|Valve Project Creator (VPC)]] to generate platform-specific project files and makefiles. These files are platform specific and are required in order to build the SDK. Once you complete this step, there will be no need to run this step again unless an update requires new project files.
+
# Download and install [https://go.microsoft.com/fwlink/?LinkId=532495&clcid=0x409 Visual Studio 2013].
 +
# Download and install the [https://download.microsoft.com/download/0/2/3/02389126-40A7-46FD-9D83-802454852703/vc_mbcsmfc.exe Multibyte MFC Library].
 +
{{note|The Multibyte MFC Library add-on doesn't work with Visual Studio Express 2013. The add-on installer doesn't detect Visual Studio Express 2013 as an install because Visual Studio Express 2013 doesn't support MFC.}}
  
===Windows===
+
===Step Two: Installing the Microsoft Speech SDK===
# Single Player Project
+
# Download the [http://www.microsoft.com/en-us/download/confirmation.aspx?id=10121 Microsoft Speech SDK]
> ''<SDK_ROOT>''/sp/src/creategameprojects.bat
+
# Extract install files and run <code>Microsoft Speech SDK 5.1.msi</code>
> ''<SDK_ROOT>''/sp/src/createallprojects.bat
+
# Copy <code>C:\Program Files (x86)\Microsoft Speech SDK 5.1</code> to <code><SDKROOT>\sp\src\utils</code> folder or <code><SDKROOT>\mp\src\utils</code> folder depending on your mod.
+
# '''Make sure that your directory looks like this : \sp\src\utils\sapi51''' then should contain Bin Docs IDL etc. And not like this : \sp\src\utils\Microsoft Speech SDK 5.1\sapi51. If it's like the latter it will throw up error code 1 on compile.  
# Multiplayer Project
+
# Open <code>'''sphelper.h'''</code> (located in : <code><SDKROOT>\sp\src\utils\sapi51\include</code>) and fix the following errors:
> ''<SDK_ROOT>''/mp/src/creategameprojects.bat
 
> ''<SDK_ROOT>''/mp/src/createallprojects.bat
 
  
This step will create Visual Studio Project (.vcxproj) and Solution (.sln) files in the SRC directory.
 
  
'''Note:''' If you do not have Visual Studio installed, you will receive errors in the above process.
+
'''Line 769''' :
 
 
===Mac OS X &amp; Linux===
 
# Single Player Project
 
> ''<SDK_ROOT>''/sp/src/creategameprojects
 
 
# Multiplayer Project
 
> ''<SDK_ROOT>''/mp/src/creategameprojects
 
 
 
On Mac OS X, this will create both `.mak` and Xcode project files in the SRC directory.
 
 
 
On Linux, `.mak` will be generated in the SRC directory.
 
 
 
=== Information about VPC ===
 
For more information on how to use [[Valve Project Creator|VPC]], look at the scripts themselves or run the following command on any platform:
 
> ''<SDK_ROOT>''/''<gameType>''/src/devtools/bin/vpc /help
 
 
 
=== Note on Git Repository & Ignored Files ===
 
All these generated files from VPC are listed in the .gitignore file and ignored for commits in the repository. Individuals wanting to pull request changes should be aware of this while pushing changes.
 
 
 
==Windows==
 
 
 
=== Prerequisites ===
 
To build the Source SDK 2013 on Windows you will need [http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express Microsoft Visual Studio 2010] with [http://www.microsoft.com/en-us/download/details.aspx?id=23691 Service Pack 1]. It's also possible to use Visual Studio 2012 with the Visual Studio 2010 compiler by not "updating" the project settings to the new compiler.
 
 
 
If you want to build the phonemeextractor project you will need to download [http://www.microsoft.com/en-us/download/details.aspx?id=10121 SAPI 5.1] from Microsoft. We aren't able to ship the Speech SDK with the Source SDK. Just download SpeechSDK51.exe, choose an extraction directory, and hit "Extract". Go to the directory with the extracted files and run the MSI installer. Locate "C:/Program Files (x86)/Microsoft Speech SDK 5.1" (or your desired installation path), copy it to "src/utils/", then rename the "Microsoft Speech SDK 5.1" folder to "sapi51" and phonemeextractor will be able to link.
 
 
 
=== Building ===
 
''Remember to [[#Creating Project & Makefiles|create project & make files]] first!''
 
 
 
# Open the "everything" solution file for the project type you wish to make.
 
#* everything.sln
 
# Build the above solution.
 
# Open the solution file for the game you are building the mod for.
 
#* games.sln
 
# Build the above solution.
 
 
 
At this point you should have '''client.dll''' and '''server.dll''' to load with the Source Engine game you based the mod on.
 
 
 
=== Building Shaders ===
 
 
 
If you are adding shaders in your mod you will need to build the runtime shader files on Windows.
 
# Open a command prompt and CD to one of the following:
 
#* <code>sp/src/materialsystem/stdshaders</code>  (for single player mods)
 
#* <code>mp/src/materialsystem/stdshaders</code> (for multiplayer mods)
 
# Duplicate the file <code>build''<gamename>''shaders.bat</code> and rename the file to <code>buildmyshaders.bat</code>
 
COPY /B build''<gamename>''shaders.bat buildmyshaders.bat
 
<ol start="3">
 
<li>Open the file <code>buildmyshaders.bat</code> in your text editor of choice.</li>
 
<li>Change the variable <code>'''SDKBINDIR'''</code> to the location of the client data from Steam. This location may be different depending on your game's install location.</li>
 
</ol>
 
set SDKBINDIR=''<steaminstallpath>''\SteamApps\common\Source SDK Base 2013 Singleplayer\bin
 
<ol start="5">
 
<li>Run <code>buildmyshaders.bat</code></li>
 
</ol>
 
 
 
For more information on authoring shaders in the Source SDK, see [[Shader Authoring]].
 
 
 
===Compiling Source SDK 2013 with Visual Studio 2012===
 
 
 
Valve recommends that mod creators should use Visual Studio 2010 with Service Pack 1 to create a mod. However, this section describes how to compile a mod using Visual Studio 2012. Follow the guide on this page up until the [[#Prerequisites|Windows - Prerequisites]] section. In the [[#Prerequisites|Windows - Prerequisites]] section, it recommends that the mod creator does not update the Visual Studio projects and touches on the fact that the mod creator will have to obtain sapi.lib from Microsoft's Speech SDK. This section will describe instead how to 1. obtain and setup the Speech SDK library, 2. setup the necessary protobuf library and 3. setup and compile the Source SDK 2013 with Visual Studio 2012.
 
 
 
{{note|Avoid errors by only compiling the solution after setting up Speech API and protobuf.}}
 
 
 
==== Setting up Microsoft Speech SDK (SAPI) ====
 
 
 
The Source SDK requires the Microsoft Speech SDK but doesn't come with it for licensing reasons. Download the Speech SDK 5.1 from [http://www.microsoft.com/en-us/download/details.aspx?id=10121 here]. This should download the SpeechSDK51.exe file. Run this and it should unzip contents to a selected folder. One of the contents it unzips is Microsoft SDK 5.1.msi. Running this with the default settings should create a directory in <code>C:\Program Files (x86)</code> called <code>Microsoft Speech SDK 5.1</code>. Copy the <code>Microsoft Speech SDK 5.1</code> directory into the <code>src/utils</code> directory and rename it <code>sapi51</code>.
 
 
 
Compiling now shows a number of errors in the <code>sphelper.h</code> file. There is [http://stackoverflow.com/questions/7224902/how-to-fix-compiler-errors-in-sapi-5-1-header-files more than one way] to fix these errors. This section will describe how to fix them manually.
 
 
 
Change the following lines t have the code shown below.
 
 
 
Line 769
 
 
<code>
 
<code>
 
     const size_t ulLenVendorPreferred = wcslen(pszVendorPreferred); // no size_t
 
     const size_t ulLenVendorPreferred = wcslen(pszVendorPreferred); // no size_t
 +
</code>
  
Line 1418
+
'''Line 1418''' :
 
<code>
 
<code>
 
     static long CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX) // missing long
 
     static long CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX) // missing long
 
</code>
 
</code>
  
Line 2368
+
'''Line 2368''' :
 
<code>
 
<code>
 
     const WCHAR * PropertyStringValue() const
 
     const WCHAR * PropertyStringValue() const
Line 146: Line 78:
 
</code>
 
</code>
  
Line 2560
+
'''Line 2560''' :
 
<code>
 
<code>
 
     SPPHONEID* pphoneId = (SPPHONEID*)((WCHAR *)dsPhoneId); // improper casting
 
     SPPHONEID* pphoneId = (SPPHONEID*)((WCHAR *)dsPhoneId); // improper casting
 
</code>
 
</code>
  
Line 2634
+
'''Line 2634''' :
 
<code>
 
<code>
 
     pphoneId += wcslen((const wchar_t *)pphoneId) + 1; // improper casting
 
     pphoneId += wcslen((const wchar_t *)pphoneId) + 1; // improper casting
 
</code>
 
</code>
  
{{note|Building now might generate an error <code>unresolved symbol _IID_IspPhoneticAlphabetSelection</code>. This was perhaps caused because you had already built and the partial build is broken. This could be fixed by rebuilding the <code>phonemeextractor</code> project.}}
+
{{note|Mounting it now may generate the error <code>unresolved symbol _IID_IspPhoneticAlphabetSelection</code>. This is perhaps because you already had something mounted and the partial build is broken. This issue can be easily fixed by rebuilding the <code>phonemeextractor</code>}}
  
==== Setting up protobuff ====
+
===Step Three: Compiling the Source SDK and preparing project files===
 +
# Navigate to <code><path-to-git>\sp\src\</code> and run '''createallprojects.bat''' and '''creategameprojects.bat'''
 +
# Navigate to <code><path-to-git>\mp\src\</code> and run '''createallprojects.bat''' and '''creategameprojects.bat'''
 +
{{Note|The '''Everything''' solution also contains the '''Game''' solutions along with other tools.}}
 +
# Open '''everything.sln''' for the desired mode (Singleplayer or Multiplayer).
 +
# Select the '''everything''' solution, located under the '''Solution Explorer''' list, then from the middle menu, right next to the '''Auto''' drop down menu (the properties box/pane under the solution explorer), change '''Debug''' to '''Release'''.
 +
# Right Click on the '''everything''' solution, then select '''Build Solution'''.
  
The Source SDK 2013 requires a protobuff version 2.3.0 library. A detailed set of instructions on obtaining and compiling the protobuf library can be found [https://wiki.alliedmods.net/Compiling_libprotobuf here] on the Allied Modders Wiki.
+
'''Notes'''
 +
<br>
 +
{{Note|If something fails at the end, then simply rebuild the solution.}}
 +
{{Note|The '''client.dll''' is going to be generated in <code><path-to-git>\sp\src\game\client\Release_mod_hl2</code> and <code><path-to-git>\sp\src\game\client\Release_mod_episodic</code>}}
 +
{{Note|The '''server.dll''' is going to be generated in <code><path-to-git>\sp\src\game\server\Release_mod_hl2</code> and <code><path-to-git>\sp\src\game\server\Release_mod_episodic</code>}}
 +
{{Note|The current Singleplayer branch will crash on startup, unless you are using the beta-branch of the Source SDK Base 2013. In Steam, go to Tools > Source SDK Base 2013 Singleplayer, right click > Properties > Betas to opt into the beta. This requirement will go away in the very near future. Without the beta, you get two popups about "Entry Point Not Found" in hl2.exe, and then the debugger breaks on engine.dll}}
  
Once compiled, copy the <code>libprotobuf.lib</code> file from <code>protobuf-2.3.0\vsprojects\Debug</code> or <code>protobuf-2.3.0\vsprojects\Release</code>, depending on which configuration it was built in, and paste it into the <code>src\lib\public</code> directory.
+
===Step Four : Building the shaders===
 +
See [[Source SDK 2013: Shader Authoring]].
  
==== Setting up the Visual Studio Projects ====
+
==Source SDK 2013 on OS X==
  
Open everything.sln in either the <code>source-sdk-2013\sp\src</code> or <code>source-sdk-2013\mp\src</code> directory depending on if your mod is a single player or multiplayer mod, respectively. A [http://i.imgur.com/1iZJmsd.png prompt] should appear asking if you want to update the VC++ compiler and libraries for each project in the solution. More details of this process can be found [http://msdn.microsoft.com/en-us/library/hh690665(v=vs.110).aspx here]. Click the <code>Update</code> button to update the projects and solution. If you don't get such a prompt or earlier chose not to update, the projects within the solution can be updated to the newest Visual Studio at any time by right-clicking on the solution and selecting <code>Update VC++ Projects</code>.
+
===Step One : Requirements===
 +
# Get OS X Mavericks which is capable of running on a Virtual Machine.
 +
# Install [https://developer.apple.com/downloads/more Xcode 5.0.2 (requires an Apple Developer ID account)].  
 +
# You will also need to have the "Command Line Tools" installed. You can find this in Xcode ''Preferences -> Downloads -> Components'' window.
  
Select the project configuration to be build, either Debug or Release. This is done by right-clicking on the <code>everything</code> solution in the solution explorer, selecting <code>properties</code>, then navigating to <code>Configuration Properties/Configuration Manager/Active Solution Configuration</code>, selecting either Debug or Release (Debug is default), pressing <code>Close</code> and then <code>Ok</code>.
+
{{Note|If you're trying to use a later macOS/Xcode combination, you should modify the <code>src/devtools/base.xcconfig</code> file in order to generate more compatible project settings (the most important one being <code>SDKROOT</code> at the end).}}
  
Now build the solution by right-clicking on the <code>everything</code> solution in the solution explorer and clicking <code>Build All</code>. Now close the <code>everything</code> solution, open the <code>games</code> solution and update the projects as you did for the <code>everything</code> solution. Continue the guided setup process from the [[#Building Shaders|Building Shaders]] section.
+
{{Warning|If you are using macOS Mojave or higher, building the Source SDK 2013 source code will be highly complicated due to Apple deprecating the 32 bits architecture. You will get an error/warning about updating the <code>ARCHS</code> variable in Xcode to be something else than <code>i386</code>.}}
  
{{note|Building the solution before updating sapi and updating the protobuf library may cause a number of compiler errors including <code>missing sapi.lib</code> and <code>_MSC_VER: value '1600' doesn't match value '1700'</code>. The following sections should fix these errors.}}
+
===Step Two : Generating the Xcode projects===
 +
Run the following scripts to generate project files.
 +
{{Note|You'll only need to run the scripts for the base gamemodes you're creating a mod for; ''sp'' for single player and ''mp'' for multiplayer}}
 +
<pre>
 +
cd <SDK_ROOT>/sp/src
 +
./createallprojects
 +
./creategameprojects
 +
cd <SDK_ROOT>/mp/src
 +
./createallprojects
 +
./creategameprojects
 +
</pre>
  
{{note|Once the build is complete, consider [[Installing and Debugging the Source Code#Debugging| setting up your mod for debugging]].}}
+
'''games.xcodeproj''' and '''everything.xcodeproj''' will be generated in the <code>src</code> folder.
  
==Mac OS X==
+
===Step Three : Building===
 +
To compile the tools, server and client libraries open '''everything.xcodeproj''' and '''games.xcodeproj''' in Xcode and build the projects (''Product -> Build'').
 +
{{Note|Using a more modern environment will yield some errors when compiling.}}
  
===Environment & Tools Setup===
+
===Step Four : Binaries===
Mac OS X, you will need [https://developer.apple.com/xcode/ Xcode 4.2] installed. You will also need to have "Command Line Tools" installed. You can find this at:
+
When successfully built, <code>client.dylib</code> and <code>server.dylib</code> will be created and ready to use with the desired Source SDK Base 2013 branch (singleplayer or multiplayer).
  
XCode Preferences -> "Downloads" -> "Components"
+
==Source SDK 2013 on Linux==
 +
{{TODO|Add instructions for building with the latest Steam Runtime.}}
 +
{{Note|Due to the usage of the Steam Client Runtime, a Debian based Linux distribution (Linux Mint, Ubuntu...) is recommended. Arch Linux based distributions (Antergos, Manjaro...) seems to work as well. You can take the risk of trying with another GNU/Linux distribution but keep in mind that you will have to adapt the commands and this tutorial may fail.}}
  
===Building The Tools===
+
===Step One: Getting the basic C/C++ development tools===
''Remember to [[#Creating Project & Makefiles|create project & make files]] first!''
+
You should already have these, but to be sure, you can run the following command in a terminal:
  
To run the tools, run this command under Terminal:
+
<pre>
 +
sudo apt-get install build-essential
 +
</pre>
  
> make -f games.mak
+
AMD64 (64 bits) users will need to download and install additional packages to target the i386 (32 bits) architecture, this can be done with this command in a terminal:
  
When successfully built, you should have '''client.dylib''' and '''server.dylib''' files to load with the Source SDK Base 2013 of your choice.
+
<pre>
 +
sudo apt-get install gcc-multilib g++-multilib
 +
</pre>
  
==Linux==
+
===Step Two: Preparing the Source SDK 2013===
 +
Assuming you have already cloned the Source SDK 2013 through Git (or downloaded the ZIP file), just run the following commands (by replacing [SDK_ROOT] by the location of the Source SDK 2013, [GAME] by "sp" or "mp" depending on your mod and [SCRIPT] by either "./createallprojects" or "./creategameprojects"), go into :
  
=== Steam Client Runtime ===
+
<pre>
To build the Source SDK 2013 on Linux you will need the Steam Client Runtime.
+
cd [SDK_ROOT]/[GAME]/src
 +
[SCRIPT]
 +
</pre>
  
# [http://media.steampowered.com/client/runtime/steam-runtime-sdk_latest.tar.xz Download the Steam Client Runtime.]
+
Depending on the script you ran, you will have a master Makefile called '''games.mak''' or '''everything.mak''' that will be generated in the <code>src</code> folder.
# Run the following commands to extract the runtime:
 
  
> tar xvf steam-runtime-sdk_latest.tar.xz
+
===Step Three: Downloading, installing, setting up the Steam Client Runtime===
> cd steam-runtime-sdk_''<version>''
 
  
Replace ''<version>'' with the version you just unpacked.
+
The Steam Client Runtime will help you guarantee compatibility with most GNU/Linux distributions. It is recommended to install it in "/valve/steam-runtime", if you don't like this and wish to install the Steam Client Runtime elsewhere: symbolic link is your friend. We are going to assume you want to do the first option.
 +
Run the following commands in a terminal, make sure to replace "[USER]" by your login and "[GROUP]" by your group name:
  
> ./setup.sh
+
<pre>
 +
cd /
 +
sudo mkdir valve
 +
cd valve
 +
sudo wget http://media.steampowered.com/client/runtime/steam-runtime-sdk_latest.tar.xz
 +
sudo tar xvf steam-runtime-sdk_latest.tar.xz
 +
sudo mv steam-runtime-sdk_2013-09-05 steam-runtime
 +
sudo chown <USER>:<GROUP> * -R
 +
</pre>
  
Pick your architecture and debug/release preferences. Then answer Y to everything else.
+
Run the "./setup.sh" script in the "steam-runtime" directory, select the "i386" architecture and one configuration of your choice, say "Yes" to everything related to updates.
  
> ./shell.sh --arch=i386
+
Before compiling the SDK, you have to run the sandbox (chroot environement), this is done by running the "./shell.sh --arch=i386" script.
  
=== SDK Build ===
+
===Step Four: Time to compile===
''Remember to [[#Creating Project & Makefiles|create project & make files]] first!''
 
  
With the above prerequisite installed, run the following:
+
{{Note|If you're on Arch Linux, you'll have to install the <code>[https://aur.archlinux.org/packages/dpkg/ dpkg]</code> AUR package to compile the game.}}
  
> make -f games.mak
+
In a terminal (like always), "cd" into the "sp" (singleplayer) or "mp" (multiplayer) directory of the SDK and the "src" directory, just run the following command to compile (replace [MAKEFILE] by "games.mak" or "everything.mak" depending on the one available to you):
  
At this point you should have client.so and server.so files to load with the Source SDK Base 2013 of your choice. More instructions on using the Steam runtime can be found in README.txt in the installed runtime directory.
+
make -f [MAKEFILE].mak
  
=Code Organization=
+
If everything went well, you should have the "client.so" and "server.so" files in the "game" directory to load with the appropriate Source SDK Base 2013. You can get more instructions on using the Steam Client Runtime by reading the "README.txt" file in the installed runtime directory.
  
==Naming Conventions==
+
{{Note|If you have an error about "objcopy", edit the "devtools/gendbg.sh" file and change the "OBJCOPY" variable so it points to the default "objcopy" program, usually found at <code>/usr/bin/objcopy</code>.}}
The Source SDK is split into two directories at the root for '''''<gameType>''''', followed by source for '''''<gameName>'''''. If you are building a single player mod, use the '''"sp"''' directory. If you are building a multi-player mod you should base yourself on the code in the '''"mp"''' directory.
 
  
* '''''<gameType>'''''
+
{{Note|If you extracted Steam Runtime in directory other than <code>/valve/steam-runtime</code>, specify <code>STEAM_RUNTIME_PATH</code> environment variable specifying path to extracted runtime before running make.}}
** sp (singleplayer)
 
** mp (multiplayer)
 
* '''''<gameName>'''''
 
** hl2 (Half-Life 2)
 
** episodic (Half-Life 2 Episodes)
 
** hl2mp (Half-Life 2: Deathmatch)
 
  
Each directory has a matching Source SDK 2013 Base appID to use to get the base mod files:
+
==Setting up on Steam==
* [steam://install/243730 Source SDK Base 2013 Singleplayer]
+
See [[Setup_mod_on_steam|Setup mod on steam]].
** Client AppID: 243730
 
* [steam://install/243750 Source SDK Base 2013 Multiplayer]
 
** Client AppID: 243750
 
** Server AppID: 244310 (see [[SteamCMD]] for instructions on how to install this one)
 
  
These two base apps are very similar, differing mostly in update schedule. The Singleplayer base will only update with HL2 and the Episodes do, which isn't very often. The Multiplayer base will update a few times a year to incorporate engine changes from TF2 and Counter-Strike: Source. None of these updates should break mod compatibility.
+
=Other information=
 +
<!-- Explain how to launch this command
 +
== Information about VPC ==
 +
For more information on how to use [[Valve Project Creator|VPC]], look at the scripts themselves or run the following command on any platform:
 +
> ''<SDK_ROOT>''/''<gameType>''/src/devtools/bin/vpc /help -->
  
==Directory Structure==
+
== Adding new files with the [[Valve Project Creator]] ==
Under each of these directories is a very similar directory structure:
+
# Add instructions on how to here.
 +
# Open '''hl2.vpc''' with a text editor and edit this line or something.
 +
VPC generates project files for all of the platforms that the SDK supports, so if you want to add files to your project in a way that will allow you to easily build on other platforms, consider using VPC.  For example, to add a file to a multiplayer game, you could add a line to src/game/client/client_hl2mp.vpc.
  
* game - Runtime files for the mods themselves. Your mod content will go in here.
+
== Directory structure ==
* src - All the source code for that kind of mod. The root of the src directory contains .sln or root level .mak files for building the source.
 
** common - A few files used by the server and client DLLs
 
** devtools - Scripts and utilities that are used to build the source. These are called by the makefiles and projects and you probably won't need to interact with them directly.
 
** game - All of the source code for the DLLs.
 
*** client - Code used by client.dll (or client.dylib or client.so). There are also game-specific directories under here.
 
*** server - Code used by server.dll. There are also game-specific directories under here.
 
*** shared - Code used by both client.dll and server.dll.
 
** gcsdk - A couple of tools used to build the DLLs.
 
** lib - Binary versions of the libraries that the source code depends on. This is also the build target for vgui_controls, tier1, and mathlib.
 
** mathlib - Math utilities used by the game.
 
** public - Header files for all of the DLLs and libraries that are used by the game. Also includes a few source files.
 
** thirdparty - Third party libraries needed to build the source. At the moment this contains only the [https://code.google.com/p/protobuf/ Google Protocol Buffers (protobuf)] library.
 
** tier1 - Useful utility classes. Builds into tier1.lib
 
** utils - Various development utilities
 
** vgui2 - Source code for vgui_controls, which is used by client.dll.
 
  
We recommend that you follow the conventions here as you add files for your own mod.
+
<ul>
 +
<li>game - Runtime files for the mods themselves. Any mod content will go in here.</li>
 +
<li>src - All the source code for that kind of mod. The root of the src directory contains .sln or root level .mak files for building the source.</li>
 +
<ul>
 +
<li>common - A few files used by the server and client DLLs</li>
 +
<li>devtools - Scripts and utilities that are used to build the source. These are called by the makefiles and projects and you probably won't need to interact with them directly.</li>
 +
<li>game - All of the source code for the DLLs.</li>
 +
<ul>
 +
<li>client - Code used by client.dll (or client.dylib or client.so). There are also game-specific directories under here.</li>
 +
<li>server - Code used by server.dll. There are also game-specific directories under here.</li>
 +
<li>shared - Code used by both client.dll and server.dll.</li>
 +
</ul>
 +
<li>gcsdk - A couple of tools used to build the DLLs.</li>
 +
<li>lib - Binary versions of the libraries that the source code depends on. This is also the build target for vgui_controls, tier1, and mathlib.</li>
 +
<li>mathlib - Math utilities used by the game.</li>
 +
<li>public - Header files for all of the DLLs and libraries that are used by the game. Also includes a few source files.</li>
 +
<li>thirdparty - Third party libraries needed to build the source. At the moment this contains only the [https://github.com/google/protobuf Google Protocol Buffers (protobuf)] library.</li>
 +
<li>tier1 - Useful utility classes. Builds into tier1.lib</li>
 +
<li>utils - Various development utilities</li>
 +
<li>vgui2 - Source code for vgui_controls, which is used by client.dll.</li>
 +
</ul>
 +
</ul>
  
=Common Errors=
+
=Troubleshooting=
Common errors encountered in SDK 2013. Please use [[{{TALKPAGENAME}}|Discussion]] before posting other solutions.
+
===Unable to find RegKey for .vcproj files in solutions (Windows)===
 +
* Install and update Visual Studio 2013. See [[Source SDK 2013#Source SDK 2013 on Windows|Source SDK 2013 on Windows (Step One)]].
  
== RegKey Errors While Generating Project Files==
+
Or if you don't feel like downgrading to VS2013 you can try this alternative solution and see if works for you.
 +
{{Warning|Editing the Windows registry is dangerous. Changing something you don't know can break the Windows OS.}}
  
<nowiki>"ERROR: Unable to find RegKey for .vcproj files in solutions."</nowiki>
+
* As Found in the [https://github.com/ValveSoftware/source-sdk-2013/issues/72 GitHub repository comments] One of the ways that the issue can be solved is like this:
 +
:Go to the windows registry editing 'regedit.exe' and navigate to:
 +
::<pre> HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} </pre>
 +
:Add the "'''project'''" and "'''{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}'''" registry keys if they don't already exist.
 +
:#Once inside, add a string key and name it '''DefaultProjectExtension'''.
 +
:#Right click on it and go into 'Modify'
 +
:#Set the data to '''vcproj''' and cick ok.
 +
Once You finish It should look like this:
 +
:https://i.imgur.com/aCD4DLV.png
 +
Now try run the .bat again and your .sln file should generate without issue!
  
This problem is usually caused by missing file extensions associations in the your system registry.
+
===MSB8008: Specified platform toolset (v120_xp) or (v120) is not installed or invalid (Windows)===
 +
# '''Select all Project Files'''
 +
# Right-click on the file, then choose '''"Properties"'''
 +
# Choose '''"Configuration Properties"'''
 +
# Under '''"Platform toolset"'''  this -> '''(v100)'''
  
===Visual Studio 2010===
+
(Project->Properties->Configuration Properties->General->Platform toolset = Visual Studio 2010(v100))
{{Warning|1=Make sure to have [http://www.microsoft.com/en-us/download/details.aspx?id=23691 2010 Visual Studio Service Pack 1] or later installed.}}
 
  
* Open Registry Editor
+
===Issues with "min" or "max" from Steam Runtime when Compiling on Linux===
*# Windows key + R
 
*# Type 'regedit' without quotes and then hit Enter.
 
* Navigate to one of the following registry keys, based on the operating system you're currently using:
 
  
'''''# For 32-bit (x86) Operating Systems:'''''
+
If you get any issues mentioning "min" or "max" while compiling on Linux, it is because you are including something that references the STL, and Valve's macros for min and max are conflicting with it.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Projects\{60dc8134-eba5-43b8-bcc9-bb4bc16c2548}
 
 
'''''# For 64-bit (x64) Operating Systems:'''''
 
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Projects\{60dc8134-eba5-43b8-bcc9-bb4bc16c2548}
 
  
* At the key, you will need to create a new string value.
+
Usually GCC is pretty good about telling you which files in particular are erroring.
*# Navigate to: New > String Value
 
*# Fill out the following information:
 
*#* Name: <code>DefaultProjectExtension</code>
 
*#* Value: <code>vcproj</code>
 
*# Click "OK" to save the registry key.
 
  
===Visual Studio 2012===
+
Go to those files, and surround the erroneous includes with:
A tool has been created by a member of the community to fix this type of error on Visual Studio 2012. '''''Use at your own risk.'''''
+
<pre>
Download source from [https://github.com/FrontBack/VPC-Fix GitHub] (AutoIt v3 is needed).
+
#include "tier0/valve_minmax_off.h"
 +
<your include that uses STL>
 +
#include "tier0/valve_minmax_on.h"
 +
</pre>
  
==<code>vgui_controls</code> Doesn't Compile==
+
This should allow you to compile. Make sure to only wrap the includes that are using the STL, as other, game-related includes may require the Valve min/max macro defines!
  
This problem is usually fixed by obtaining a fresh copy from the SDK distribution. If you're using a local GitHub repository, do a Sync (pull) on your repository. Otherwise you can download and reapply the ZIP file.
+
=See Also=
  
As of February 2014, this was being investigated by the community: see
+
* [[Programming]]
https://github.com/ValveSoftware/source-sdk-2013/issues/225
+
[[Category:Programming]]
This may be peculiar to building in a directory whose path contains spaces: vpc.exe will create .vcxproj files containing unquoted spaces in pathnames, some of which will then fail.
 
  
=Releasing on Steam=
 
If you have a Source Engine game that you are interested in releasing on Steam, please read [https://partner.steamgames.com/documentation/source_games this FAQ] for more details.
 
  
 
[[Category:Source SDK FAQ]]
 
[[Category:Source SDK FAQ]]
 
[[Category:Modding]]
 
[[Category:Modding]]
 
[[Category:SDK 2013]]
 
[[Category:SDK 2013]]

Latest revision as of 17:23, 9 October 2020

Español Русский 简体中文 한국어

Key points

Note:The Source SDK uses the Valve Project Creator in order to generate the required platform specific files.
Note:If you want to create a simple, content-based mod, see this fully-compiled template.
Note:You can always edit code files with Notepad ++ or a similar program, and then compile under Visual Studio.

Setting Up (All Platforms)

Setting up the Source SDK Base

Install Source SDK Base 2013 (multiplayer or singleplayer depending on your mod) from Steam->Library->Tools or from the links below:

Getting the code

Method one: Using the GitHub Desktop client (Windows/OS X)

  1. Download and install the GitHub Desktop client
  2. Open the Source SDK git repo and click "Clone to desktop"

Method two: Using the command line (Windows/OS X/Linux)

  1. Download and install the git CLI. Linux users can download it with their distro's package manager (APT, Aptitude, DNF, Pacman, Synaptic...). Mac's users can download git here.
  2. Open the terminal/command prompt and run this command:
git clone https://github.com/ValveSoftware/source-sdk-2013.git

Method three: Downloading the ZIP archive

Note:Note: You will need to update the code manually whenever changes are committed to the repo

Download from here

Setting up (Platform Specific)

Source SDK 2013 on Windows

Step One: Installing Visual Studio

Note:Although Source SDK 2013 currently does NOT compile with Visual Studio 2015 (bug report) you can still use VS 2015 as IDE and compile the code with the VS 2013 toolset.
Just install both VS 2013 and 2015, open the solution in VS 2015, and skip the dialog where VS 2015 tries to upgrade your projects.

You can also compile without Visual Studio, or using a different version.

  1. Download and install Visual Studio 2013.
  2. Download and install the Multibyte MFC Library.
Note:The Multibyte MFC Library add-on doesn't work with Visual Studio Express 2013. The add-on installer doesn't detect Visual Studio Express 2013 as an install because Visual Studio Express 2013 doesn't support MFC.

Step Two: Installing the Microsoft Speech SDK

  1. Download the Microsoft Speech SDK
  2. Extract install files and run Microsoft Speech SDK 5.1.msi
  3. Copy C:\Program Files (x86)\Microsoft Speech SDK 5.1 to <SDKROOT>\sp\src\utils folder or <SDKROOT>\mp\src\utils folder depending on your mod.
  4. Make sure that your directory looks like this : \sp\src\utils\sapi51 then should contain Bin Docs IDL etc. And not like this : \sp\src\utils\Microsoft Speech SDK 5.1\sapi51. If it's like the latter it will throw up error code 1 on compile.
  5. Open sphelper.h (located in : <SDKROOT>\sp\src\utils\sapi51\include) and fix the following errors:


Line 769 :

   const size_t ulLenVendorPreferred = wcslen(pszVendorPreferred); // no size_t

Line 1418 :

   static long CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX) // missing long

Line 2368 :

   const WCHAR * PropertyStringValue() const
   {
       // Search for the first NULL and return pointer to the char past it.
       SPDBG_ASSERT(eEventId == SPEI_PROPERTY_STRING_CHANGE);
       const WCHAR * psz = (const WCHAR *)lParam; // moved this from for init
       for (; *psz; psz++) {}
       return psz + 1;
   }

Line 2560 :

   SPPHONEID* pphoneId = (SPPHONEID*)((WCHAR *)dsPhoneId); // improper casting

Line 2634 :

   pphoneId += wcslen((const wchar_t *)pphoneId) + 1; // improper casting

Note:Mounting it now may generate the error unresolved symbol _IID_IspPhoneticAlphabetSelection. This is perhaps because you already had something mounted and the partial build is broken. This issue can be easily fixed by rebuilding the phonemeextractor

Step Three: Compiling the Source SDK and preparing project files

  1. Navigate to <path-to-git>\sp\src\ and run createallprojects.bat and creategameprojects.bat
  2. Navigate to <path-to-git>\mp\src\ and run createallprojects.bat and creategameprojects.bat
Note:The Everything solution also contains the Game solutions along with other tools.
  1. Open everything.sln for the desired mode (Singleplayer or Multiplayer).
  2. Select the everything solution, located under the Solution Explorer list, then from the middle menu, right next to the Auto drop down menu (the properties box/pane under the solution explorer), change Debug to Release.
  3. Right Click on the everything solution, then select Build Solution.

Notes

Note:If something fails at the end, then simply rebuild the solution.
Note:The client.dll is going to be generated in <path-to-git>\sp\src\game\client\Release_mod_hl2 and <path-to-git>\sp\src\game\client\Release_mod_episodic
Note:The server.dll is going to be generated in <path-to-git>\sp\src\game\server\Release_mod_hl2 and <path-to-git>\sp\src\game\server\Release_mod_episodic
Note:The current Singleplayer branch will crash on startup, unless you are using the beta-branch of the Source SDK Base 2013. In Steam, go to Tools > Source SDK Base 2013 Singleplayer, right click > Properties > Betas to opt into the beta. This requirement will go away in the very near future. Without the beta, you get two popups about "Entry Point Not Found" in hl2.exe, and then the debugger breaks on engine.dll

Step Four : Building the shaders

See Source SDK 2013: Shader Authoring.

Source SDK 2013 on OS X

Step One : Requirements

  1. Get OS X Mavericks which is capable of running on a Virtual Machine.
  2. Install Xcode 5.0.2 (requires an Apple Developer ID account).
  3. You will also need to have the "Command Line Tools" installed. You can find this in Xcode Preferences -> Downloads -> Components window.
Note:If you're trying to use a later macOS/Xcode combination, you should modify the src/devtools/base.xcconfig file in order to generate more compatible project settings (the most important one being SDKROOT at the end).

Warning: If you are using macOS Mojave or higher, building the Source SDK 2013 source code will be highly complicated due to Apple deprecating the 32 bits architecture. You will get an error/warning about updating the ARCHS variable in Xcode to be something else than i386.

Step Two : Generating the Xcode projects

Run the following scripts to generate project files.

Note:You'll only need to run the scripts for the base gamemodes you're creating a mod for; sp for single player and mp for multiplayer
cd <SDK_ROOT>/sp/src
./createallprojects
./creategameprojects
cd <SDK_ROOT>/mp/src
./createallprojects
./creategameprojects

games.xcodeproj and everything.xcodeproj will be generated in the src folder.

Step Three : Building

To compile the tools, server and client libraries open everything.xcodeproj and games.xcodeproj in Xcode and build the projects (Product -> Build).

Note:Using a more modern environment will yield some errors when compiling.

Step Four : Binaries

When successfully built, client.dylib and server.dylib will be created and ready to use with the desired Source SDK Base 2013 branch (singleplayer or multiplayer).

Source SDK 2013 on Linux

To do: Add instructions for building with the latest Steam Runtime.

Note:Due to the usage of the Steam Client Runtime, a Debian based Linux distribution (Linux Mint, Ubuntu...) is recommended. Arch Linux based distributions (Antergos, Manjaro...) seems to work as well. You can take the risk of trying with another GNU/Linux distribution but keep in mind that you will have to adapt the commands and this tutorial may fail.

Step One: Getting the basic C/C++ development tools

You should already have these, but to be sure, you can run the following command in a terminal:

sudo apt-get install build-essential

AMD64 (64 bits) users will need to download and install additional packages to target the i386 (32 bits) architecture, this can be done with this command in a terminal:

sudo apt-get install gcc-multilib g++-multilib

Step Two: Preparing the Source SDK 2013

Assuming you have already cloned the Source SDK 2013 through Git (or downloaded the ZIP file), just run the following commands (by replacing [SDK_ROOT] by the location of the Source SDK 2013, [GAME] by "sp" or "mp" depending on your mod and [SCRIPT] by either "./createallprojects" or "./creategameprojects"), go into :

cd [SDK_ROOT]/[GAME]/src
[SCRIPT]

Depending on the script you ran, you will have a master Makefile called games.mak or everything.mak that will be generated in the src folder.

Step Three: Downloading, installing, setting up the Steam Client Runtime

The Steam Client Runtime will help you guarantee compatibility with most GNU/Linux distributions. It is recommended to install it in "/valve/steam-runtime", if you don't like this and wish to install the Steam Client Runtime elsewhere: symbolic link is your friend. We are going to assume you want to do the first option. Run the following commands in a terminal, make sure to replace "[USER]" by your login and "[GROUP]" by your group name:

cd /
sudo mkdir valve
cd valve
sudo wget http://media.steampowered.com/client/runtime/steam-runtime-sdk_latest.tar.xz
sudo tar xvf steam-runtime-sdk_latest.tar.xz
sudo mv steam-runtime-sdk_2013-09-05 steam-runtime
sudo chown <USER>:<GROUP> * -R

Run the "./setup.sh" script in the "steam-runtime" directory, select the "i386" architecture and one configuration of your choice, say "Yes" to everything related to updates.

Before compiling the SDK, you have to run the sandbox (chroot environement), this is done by running the "./shell.sh --arch=i386" script.

Step Four: Time to compile

Note:If you're on Arch Linux, you'll have to install the dpkg AUR package to compile the game.

In a terminal (like always), "cd" into the "sp" (singleplayer) or "mp" (multiplayer) directory of the SDK and the "src" directory, just run the following command to compile (replace [MAKEFILE] by "games.mak" or "everything.mak" depending on the one available to you):

make -f [MAKEFILE].mak

If everything went well, you should have the "client.so" and "server.so" files in the "game" directory to load with the appropriate Source SDK Base 2013. You can get more instructions on using the Steam Client Runtime by reading the "README.txt" file in the installed runtime directory.

Note:If you have an error about "objcopy", edit the "devtools/gendbg.sh" file and change the "OBJCOPY" variable so it points to the default "objcopy" program, usually found at /usr/bin/objcopy.
Note:If you extracted Steam Runtime in directory other than /valve/steam-runtime, specify STEAM_RUNTIME_PATH environment variable specifying path to extracted runtime before running make.

Setting up on Steam

See Setup mod on steam.

Other information

Adding new files with the Valve Project Creator

  1. Add instructions on how to here.
  2. Open hl2.vpc with a text editor and edit this line or something.

VPC generates project files for all of the platforms that the SDK supports, so if you want to add files to your project in a way that will allow you to easily build on other platforms, consider using VPC. For example, to add a file to a multiplayer game, you could add a line to src/game/client/client_hl2mp.vpc.

Directory structure

  • game - Runtime files for the mods themselves. Any mod content will go in here.
  • src - All the source code for that kind of mod. The root of the src directory contains .sln or root level .mak files for building the source.
    • common - A few files used by the server and client DLLs
    • devtools - Scripts and utilities that are used to build the source. These are called by the makefiles and projects and you probably won't need to interact with them directly.
    • game - All of the source code for the DLLs.
      • client - Code used by client.dll (or client.dylib or client.so). There are also game-specific directories under here.
      • server - Code used by server.dll. There are also game-specific directories under here.
      • shared - Code used by both client.dll and server.dll.
    • gcsdk - A couple of tools used to build the DLLs.
    • lib - Binary versions of the libraries that the source code depends on. This is also the build target for vgui_controls, tier1, and mathlib.
    • mathlib - Math utilities used by the game.
    • public - Header files for all of the DLLs and libraries that are used by the game. Also includes a few source files.
    • thirdparty - Third party libraries needed to build the source. At the moment this contains only the Google Protocol Buffers (protobuf) library.
    • tier1 - Useful utility classes. Builds into tier1.lib
    • utils - Various development utilities
    • vgui2 - Source code for vgui_controls, which is used by client.dll.

Troubleshooting

Unable to find RegKey for .vcproj files in solutions (Windows)

Or if you don't feel like downgrading to VS2013 you can try this alternative solution and see if works for you. Warning: Editing the Windows registry is dangerous. Changing something you don't know can break the Windows OS.

Go to the windows registry editing 'regedit.exe' and navigate to:
 HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} 
Add the "project" and "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}" registry keys if they don't already exist.
  1. Once inside, add a string key and name it DefaultProjectExtension.
  2. Right click on it and go into 'Modify'
  3. Set the data to vcproj and cick ok.

Once You finish It should look like this:

aCD4DLV.png

Now try run the .bat again and your .sln file should generate without issue!

MSB8008: Specified platform toolset (v120_xp) or (v120) is not installed or invalid (Windows)

  1. Select all Project Files
  2. Right-click on the file, then choose "Properties"
  3. Choose "Configuration Properties"
  4. Under "Platform toolset" this -> (v100)

(Project->Properties->Configuration Properties->General->Platform toolset = Visual Studio 2010(v100))

Issues with "min" or "max" from Steam Runtime when Compiling on Linux

If you get any issues mentioning "min" or "max" while compiling on Linux, it is because you are including something that references the STL, and Valve's macros for min and max are conflicting with it.

Usually GCC is pretty good about telling you which files in particular are erroring.

Go to those files, and surround the erroneous includes with:

#include "tier0/valve_minmax_off.h"
<your include that uses STL>
#include "tier0/valve_minmax_on.h"

This should allow you to compile. Make sure to only wrap the includes that are using the STL, as other, game-related includes may require the Valve min/max macro defines!

See Also