Compiling under VS2005: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Spam revert.)
(cleanup)
Line 1: Line 1:
{|align=right
{{toc|right}}
|__TOC__
|}
 


== Introduction ==
== Introduction ==
The following is a general guide to getting [[HL2]] compiling under VS 2005. Its important to note that the SDK code for HL2 supports VS2005, but only in the <code>the _2005.sln</code> files. Compiling <code>a _2003.sln</code> under 2005 and visa versa will only generate problems and errors. Older versions of the source code did not support 2005, to get them working with 2005 go [[Compiling under VS2005/Older SDK|here]].


The following is a general guide to getting HL2 compiling under VS 2005. Its important to note that the SDK code for HL2 supports VS2005, but only in the the _2005.sln files. Compiling a _2003.sln under 2005 and visa versa will only generate problems and errors. Older versions of the source code did not support 2005, to get them working with 2005 go [[Compiling under VS2005/Older SDK|here]].
== What's working ==
 
=== Single-player ===
== What's Working ==
 
''SP''
*Release - client - VS Studio: '''working''' & playable
*Release - client - VS Studio: '''working''' & playable
*Release - hl - VS Studio: '''working''' & playable
*Release - hl - VS Studio: '''working''' & playable
Line 16: Line 11:
*Release - hl - V C++ Express: '''working''' & playable (after [[Compiling_under_VS2005#Requirements|requirements]] are fullfilled)
*Release - hl - V C++ Express: '''working''' & playable (after [[Compiling_under_VS2005#Requirements|requirements]] are fullfilled)


''MP''
=== Multiplayer ===
*Release - client - VS Studio: '''working'''  & playable
*Release - client - VS Studio: '''working'''  & playable
*Release - hl - VS Studio: '''working''' & playable
*Release - hl - VS Studio: '''working''' & playable
*Release - client - V C++ Express: '''working''' & playable (after [[Compiling_under_VS2005#Requirements|requirements]] are fullfilled)
*Release - client - V C++ Express: '''working''' & playable (after [[Compiling_under_VS2005#Requirements|requirements]] are fullfilled)
*Release - hl - V C++ Express: '''working''' & playable (after [[Compiling_under_VS2005#Requirements|requirements]] are fullfilled)
*Release - hl - V C++ Express: '''working''' & playable (after [[Compiling_under_VS2005#Requirements|requirements]] are fulfilled)


== Requirements ==
== Requirements ==
Necessary steps are needed to enable compiling with the Visual Studio C++ 2005 Express Edition:
Necessary steps are needed to enable compiling with the Visual Studio C++ 2005 Express Edition:


''Files required''
=== Files ===
 
*[http://msdn.microsoft.com/directx/sdk/ MS DirectX SDK]
*[http://msdn.microsoft.com/directx/sdk/ MS DirectX SDK]
*[http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en Microsoft Platform SDK] For Windows 2000/XP/Server 2003
*[http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en Microsoft Platform SDK] For Windows 2000/XP/Server 2003
*[http://www.microsoft.com/downloads/details.aspx?familyid=4377F86D-C913-4B5C-B87E-EF72E5B4E065&displaylang=en Microsoft Windows SDK] For Windows Vista
*[http://www.microsoft.com/downloads/details.aspx?familyid=4377F86D-C913-4B5C-B87E-EF72E5B4E065&displaylang=en Microsoft Windows SDK] For Windows Vista


''Setup''
=== Setup ===
 
Go to Tools - Options: Projects and Solutions - VC++ Directories
Go to Tools - Options: Projects and Solutions - VC++ Directories


Line 48: Line 40:
:* Repeat these steps for 'server_hl2'
:* Repeat these steps for 'server_hl2'


== Possible Problems ==
== Potential problems ==
''Correcting Custom Build Step''
''Correcting Custom Build Step''


The Custom Build step which copies the DLLs to your mod's directory is incorrect in the 2005 solution. When you attempt to run your game, it will crash upon trying to access gpGlobals, with an access violation at memory location 0x0000038.  
The Custom Build step which copies the DLLs to your mod's directory is incorrect in the 2005 solution. When you attempt to run your game, it will crash upon trying to access <code>gpGlobals</code>, with an access violation at memory location 0x0000038.  
{{note|Only follow this step if you encounter this issue. Often, it is not required}}
{{note|Only follow this step if you encounter this issue. Often, it is not required}}


Right-click on the client_sdk project, and go to Configuration Properties -> Custom Build Step -> General. Set Command Line to:
Right-click on the <code>client_sdk</code> project, and go to Configuration Properties -> Custom Build Step -> General. Set the "Command Line" to:


  if exist "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll" attrib -r "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll"
  if exist "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll" attrib -r "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll"
Line 65: Line 57:
  "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll";"c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.pdb"
  "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll";"c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.pdb"


(In both, replace "MyMod" with your mod's directory.)
(In both cases, replace the "MyMod" entry with the actual name of your mod directory.)
 
Click "Apply" (you ''will'' lose your changes if you skip this step). At the top-left, bring down the "Configuration" combo box, set it to "Release SDK", and set Command Line and Outputs to the same values. The <code>server_sdk</code>'s custom build steps should be correct.


Click "Apply" (you *will* lose your changes if you forget this). At the top left, bring down the Configuration combo box, set it to Release SDK, and set Command Line and Outputs to the same values. The server_sdk's custom build steps should be correct.
== See also ==
* [[Microsoft Visual Studio 6.0 Usage]]
* [[Compiling under VS2008]]
* [[Compiling under VS2002]]
* [[Compiling under VS2005/Older SDK]]


== Related Articles ==
{{otherlang:en}}
*[[Microsoft Visual Studio 6.0 Usage]]
{{otherlang:en:de|Compiling_under_VS2005:de}}
*[[Compiling under VS2008]]
*[[Compiling under VS2002]]
*[[Compiling under VS2005/Older SDK]]


{{otherlang:en}} {{otherlang:en:de|Compiling_under_VS2005:de}}
[[Category:Tutorials]]
[[Category:Tutorials]] [[Category:Programming]]
[[Category:Programming]]

Revision as of 15:13, 1 December 2007

Introduction

The following is a general guide to getting HL2 compiling under VS 2005. Its important to note that the SDK code for HL2 supports VS2005, but only in the the _2005.sln files. Compiling a _2003.sln under 2005 and visa versa will only generate problems and errors. Older versions of the source code did not support 2005, to get them working with 2005 go here.

What's working

Single-player

  • Release - client - VS Studio: working & playable
  • Release - hl - VS Studio: working & playable
  • Release - client - V C++ Express: working & playable (after requirements are fullfilled)
  • Release - hl - V C++ Express: working & playable (after requirements are fullfilled)

Multiplayer

  • Release - client - VS Studio: working & playable
  • Release - hl - VS Studio: working & playable
  • Release - client - V C++ Express: working & playable (after requirements are fullfilled)
  • Release - hl - V C++ Express: working & playable (after requirements are fulfilled)

Requirements

Necessary steps are needed to enable compiling with the Visual Studio C++ 2005 Express Edition:

Files

Setup

Go to Tools - Options: Projects and Solutions - VC++ Directories

  • In the upper right drop down box, select "Executable files" and add "...\Microsoft Platform SDK\Bin" (replace with the correct path)
  • Then select "Include files" and add "...\Microsoft Platform SDK\Include" and "...\Microsoft DirectX SDK (December 2005)\Include"
  • Then select "Library files" and add "...\Microsoft Platform SDK\Lib" and "...\Microsoft DirectX SDK (February 2007)\Lib\x86"
  • Finally, in the Solution Explorer right click 'client_hl2', and select Properties, then:
  • In the client_hl2 properties window, navigate to Linker -> Input
  • Select the 'Additional Properties' row. Then click the '...' on the right hand side of the row
  • If there is already an entry here, take a new line after it, and type ' user32.lib ' without the quotes.
  • Repeat these steps for 'server_hl2'

Potential problems

Correcting Custom Build Step

The Custom Build step which copies the DLLs to your mod's directory is incorrect in the 2005 solution. When you attempt to run your game, it will crash upon trying to access gpGlobals, with an access violation at memory location 0x0000038.

Note.pngNote:Only follow this step if you encounter this issue. Often, it is not required

Right-click on the client_sdk project, and go to Configuration Properties -> Custom Build Step -> General. Set the "Command Line" to:

if exist "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll" attrib -r "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll"
if exist "$(TargetDir)"client.dll copy "$(TargetDir)"client.dll "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll"
if exist "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.pdb" attrib -r "c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.pdb"
if exist "$(TargetDir)"client.pdb copy "$(TargetDir)"client.pdb "c:\program files\steam\steamapps\SourceMods\MyMod\bin"

Set Outputs to:

"c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.dll";"c:\program files\steam\steamapps\SourceMods\MyMod\bin\client.pdb"

(In both cases, replace the "MyMod" entry with the actual name of your mod directory.)

Click "Apply" (you will lose your changes if you skip this step). At the top-left, bring down the "Configuration" combo box, set it to "Release SDK", and set Command Line and Outputs to the same values. The server_sdk's custom build steps should be correct.

See also

Template:Otherlang:en Template:Otherlang:en:de