Zh/Compiling under VS2005: Difference between revisions
(Created page with "{{otherlang2 | de = Compiling_under_VS2005:de | ru = Compiling_under_VS2005:ru |en = Compiling_under_VS2005 }} {{toc-right}} Visual Studio 2005 is the officially-supported [...") |
No edit summary |
||
Line 7: | Line 7: | ||
{{toc-right}} | {{toc-right}} | ||
Visual Studio | Visual Studio 2005是SourceSDK的正式支持[[Wikipedia:Integrated development environment|IDE开发工具]],如果过程顺利,你并不需要设置什么特殊的步骤。如果您使用的是VS2005 Express版本,那么请继续阅读, '''本文假设您打算编译的是Orange Box版本的SDK''' | ||
== | == 安装 == | ||
建议您使用Visual Studio 2005 专业版,因为它包括了Windows/Platform SDK。 | |||
VCE2005已经不在被微软官方支持。[http://download.microsoft.com/download/A/9/1/A91D6B2B-A798-47DF-9C7E-A97854B7DD18/VC.iso 不过它仍然可以从这里下载]。 | |||
当Vs或者vce已经安装完毕,建议您安装[https://support.microsoft.com/en-us/help/928957 SP1补丁] ([https://blogs.msdn.microsoft.com/heaths/2006/10/06/vs-2005-sp1-requires-a-lot-of-disk-space/注意它可能占用许多安装空间错误])以及[https://www.microsoft.com/en-us/download/details.aspx?id=7524 SP1的Vista更新].然后运行Windows更新来修复它(如果没有更新给VS/VSE,请不要担心)。 | |||
== Windows SDK (仅限Express) == | |||
如果您使用的是VCE2005,您需要去安装Windows SDK。 | |||
注意下面提供的Windows7 SDK会导致VS 2010出问题。 | |||
<strike>不用在意您安装的版本</strike>*; [http://web.archive.org/web/20161108080358/http://www.microsoft.com/en-us/download/details.aspx?id=24826 它]会做的很好的。不要说vista了,它同样涵盖XP系统。 | |||
如果您是Windows2000用户(哦,现在还有吗?最低也是7系统吧,这篇教程估计很老了!)请看这个[[Compiling under VS2005/Older SDK|Older SDK]]。 | |||
:''*:我非常确信您不必担心安装的版本,请看 [[#error C2733 referring to winnt.h or intrin.h|这里]]. -- [[User:Neverender|Neverender]] 17:26, 6 October 2012 (PDT)'' | |||
{{note|您只需安装“头和库”文件,大概有20Mb,完整的SDK将会有2GB!}} | |||
{{note| | {{note|如果您是64位系统用户,仍然选择默认的32位!}} | ||
安装完毕后,您需要告诉vc++,windowsSDK的位置. 去做这个, 导航到 ''Tools/工具 > Options/选项 > Projects and Solutions/项目和解决方案 > VC++ Directories/VC++导航''.添加windowsSDK的<code>\bin</code>文件到列表。默认位于<code>C:\Program Files\Microsoft SDKs\Windows\v6.1\bin</code>。 | |||
点击drop_down表,实际叫“Executable files”,您需要将\include文件添加至incline表,以及\lib文件添加至library表。 | |||
[[Image:Vc2005 dirs.png|center|Adding the Windows SDK's includes.]] | [[Image:Vc2005 dirs.png|center|Adding the Windows SDK's includes.]] | ||
{{tip| | {{tip|如果您已安装directXSDK同样也要进行这个过程。}} | ||
== | == 打开解决方案 == | ||
# | # 打开您的'''Microsoft Visual Studio'''. | ||
# | # 从菜单选择 '''File->Open->Project/Solution'''并打开 '''Game_Episodic-2005.sln''' 文件位于您的mod目录 <code>src</code> 内。选择适合您的'''Microsoft Visual Studio'''版本。 | ||
== LNK2019 | == LNK2019 错误 == | ||
如果您发现了这个错误,依次右键client和server项目,然后再菜单中选择最后一个选项, Properties. 然后导航至''Configuration properties > Linker > Input'' 并 make the first item, "Additional Dependencies", 阅读 <code>winmm.lib user32.lib</code>. 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”。 | |||
== | ==引用winnt.h 或者 intrin.h的错误 C2733 == | ||
您应该得到一个错误提示: "<code>error C2733: second C linkage of overloaded function '_interlockedbittestandreset' not allowed</code>" | |||
这个错误是尝试建立与windowsSDK/platform SDK不兼容版本产生的. 当使用vc++2005完整版时, 您的vc++目录(在 "Options")不应该引用任何新版的外部sdk(包括include和lib); 默认情况下只能包括vc++2005的,恢复出产设置可以修复。 | |||
仅限'''Express用户''', 如果您没有好的选择去安装windowsSDK, [http://www.microsoft.com/en-us/download/details.aspx?id=6510 这个版本]可以提供帮助. 如果 '''都失败了''', 可以通过编辑SDK的header解决。 | |||
{{warning| | {{warning|注意这并不是一个好方法,这是最后的手段(如果都不行)}} | ||
以下是先前给出的说明: | |||
:''" | :''"打开 <code>C:\Program Files\Microsoft Visual Studio 8\VC\include\intrin.h</code> 然后注释掉第944和945行,如果还不行注释掉912和913并重新编译"'' | ||
<i>You put the same download before in Windows SDK Express Only. : MatiasKiller21 [https://developer.valvesoftware.com/wiki/User:MatiasKiller21] : July 01 2015.</i> | <i>You put the same download before in Windows SDK Express Only. : MatiasKiller21 [https://developer.valvesoftware.com/wiki/User:MatiasKiller21] : July 01 2015.</i> | ||
== | == 启动您的mod == | ||
如果您是debug版本,请与-allowdebug运行。 | |||
== | == 参见 == | ||
* [[Compiling under VS2010]] | * [[Compiling under VS2010]] |
Revision as of 23:56, 6 March 2020
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用户(哦,现在还有吗?最低也是7系统吧,这篇教程估计很老了!)请看这个Older SDK。
- *:我非常确信您不必担心安装的版本,请看 这里. -- Neverender 17:26, 6 October 2012 (PDT)


安装完毕后,您需要告诉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表。

打开解决方案
- 打开您的Microsoft Visual Studio.
- 从菜单选择 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”。
引用winnt.h 或者 intrin.h的错误 C2733
您应该得到一个错误提示: "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解决。

以下是先前给出的说明:
- "打开
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运行。