用VS2005编译

From Valve Developer Community
Jump to: navigation, search
English (en)Deutsch (de)русский (ru)中文 (zh)
... Icon-Important.png

Visual Studio 2005是SourceSDK的正式支持IDE开发工具,如果过程顺利,你并不需要设置什么特殊的步骤。如果您使用的是VS2005 Express版本,那么请继续阅读,本文假设您打算编译的是Orange Box版本的SDK

安装

建议您使用Visual Studio 2005专业版,因为它包括了Windows/Platform SDK。 VCE2005已经不在被微软官方支持。不过它仍然可以从这里下载。 当VS或者VCE已经安装完毕,建议您安装SP1补丁 ([1])以及SP1的Vista更新.然后运行Windows更新来修复它(如果没有更新给VS/VSE,请不要担心)。

Windows SDK (仅限Express)

如果您使用的是VCE2005,您需要去安装Windows SDK。


注意下面提供的Windows7 SDK会导致VS 2010出问题。

不用在意您安装的版本*; 会做的很好的。不要说vista了,它同样涵盖XP系统。

如果您是Windows2000用户,请看Older SDK

*:我非常确信您不必担心安装的版本,请看这里. -- Neverender 17:26, 6 October 2012 (PDT)
Note.pngNote:您只需安装「头和库」文件,大概有20Mb,完整的SDK将会有2GB!
Note.pngNote:如果您是64位系统用户,仍然选择默认的32位。

安装完毕后,您需要告诉vc++,windowsSDK的位置. 去做这个, 导航到 Tools/工具 > Options/选项 > Projects and Solutions/项目和解决方案 > VC++ Directories/VC++导航.添加windowsSDK的\bin文件到列表。默认位于C:\Program Files\Microsoft SDKs\Windows\v6.1\bin

点击drop_down表,实际叫“Executable files”,您需要将\include文件添加至incline表,以及\lib文件添加至library表。

Adding the Windows SDK's includes.
Tip.pngTip:如果您已安装directXSDK同样也要进行这个过程。

打开解决方案

  1. 打开您的Microsoft Visual Studio.
  2. 从菜单选择 File->Open->Project/Solution并打开 Game_Episodic-2005.sln 文件位于您的mod目录 src 内。选择适合您的Microsoft Visual Studio版本。

LNK2019错误

如果您发现了这个错误,依次右键client和server项目,然后再菜单中选择最后一个选项, Properties. 然后导航至Configuration properties > Linker > Input 并 make the first item, "Additional Dependencies", 阅读 winmm.lib user32.lib. Make sure you've done this for both Debug and Release mode (switch between them in the top left of the Properties window).

如果您出现了「无法解决的外部错误」,请尝试添加「kernel32.lib」。

错误C2733:引用winnt.h或者intrin.h

您应该得到一个错误提示: "error C2733: second C linkage of overloaded function '_interlockedbittestandreset' not allowed"

这个错误是尝试建立与windowsSDK/platform SDK不兼容版本产生的. 当使用vc++2005完整版时, 您的vc++目录(在 "Options")不应该引用任何新版的外部sdk(包括include和lib); 默认情况下只能包括vc++2005的,恢复出产设置可以修复。

仅限Express用户, 如果您没有好的选择去安装windowsSDK, 这个版本可以提供帮助. 如果 都失败了, 可以通过编辑SDK的header解决。

Warning.pngWarning:编辑官方头文件并不是一个好方法,这是最后的手段(如果都不行)

以下是先前给出的说明:

"打开 C:\Program Files\Microsoft Visual Studio 8\VC\include\intrin.h 然后注释掉第944和945行,如果还不行注释掉912和913并重新编译"

You put the same download before in Windows SDK Express Only. : MatiasKiller21 [2] : July 01 2015.

启动您的mod

如果您是debug版本,请与-allowdebug运行。

参见