准备vs2012,vs2015绿色便携版,或者安装版。
绿色便携版下载地址,vs绿色便携版下载
下面我们来提取编译器,实际上vs开发工具集成编译环境IDE包含编辑器和编译器,而我们仅仅需要vc编译器+必要的windows SDK即可实现编译,
1,打开便携版目录,我们主要关心这两个文件夹。
先打开common7\IDE
找到以下4个文件,右键复制
进去VC\bin目录,粘贴,如果提示重复,可以跳过不覆盖。
在这个文件夹下面运行以下cl.exe,link.exe等exe,看是否能运行,可以打开cmd运行拖动exe到cmd中执行。。。。
已经能够提示用法,表示这个exe程序可以正常执行,其他的一样的可以测试一下。
下面我们为vs2010添加新的平台集,v140
打开如下路径
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets
新建两个文件夹,v140,v110
进入v90,选择这两个文件复制到v140,v110
粘贴到v140后,修改这两个文件的名字v90改v140
然后用记事本或者notepad++打开这两个文件。
替换所有v90文本为v140
找到这个文件的第一个<VCInstallDir>
将目录改成你的vs2015的vc目录,如:E:\Visual Studio 2015 Enterprise\VC\ ,注意最后的斜杠。
我这个文件后面还有一个 <VCInstallDir Condition="'$(VCInstallDir)' == ''">d:\vc\vc9\</VCInstallDir> 这句可以不要,可以删除。。
按照上次的例子添加相关项目,如图。
现在我们可以用vs2010新建一个项目测试测试,看看有什么问题。。
更改项目平台为v140
直接编译。
用everything搜索一下。
这个是我win10系统下的目录,因为我这台电脑上没有安装vs2015相关的windwos SDK,所以无法找到这个文件。。
所以必须找到一份windws10的SDK,因为我已经有了,我就不去折腾了,自行百度解决吧。而且这个文件夹有1.78G,不好上传。
回归主题,继续编辑Microsoft.Cpp.X64.v140 这个文件,找到第一个<WindowsSdkDir 后面的路径改为winsows10 SDK的路径如。
G:\Program Files (x86)\Windows Kits\10
再次编译。
这个是winver版本设置低了的缘故。打开项目文件的stdafx.h
替换一下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#if _MSC_VER < 1300
#define WINVER 0x0400
#elif _MSC_VER > 1500 // vc9
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0601 // Change this to the appropriate value to target IE 5.0 or later.
#endif
#else
//- Modify the following defines if you have to target a platform prior to the ones specified below.
//- Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER //- Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0400 //- Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT //- Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 //- Change this to the appropriate value to target Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS //- Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 //- Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE //- Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0400 //- Change this to the appropriate value to target IE 5.0 or later.
#endif
#endif
|
再次编译
启动调试
测试一下断点。
正常。。
至此,v140x64编辑完成,同样的方式,win32,v110都是类似的。。不再重复。。
附 上完整的x64 prop文件,仅供参考。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<!--
***********************************************************************************************
Microsoft.Cpp.x64.v140.props
WARNING: DO NOT MODIFY
this
file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to
this
file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<Import Project=
"$(VCTargetsPath)\Platforms\x64\PlatformToolsets\v140\ImportBefore\*.props"
Condition=
"Exists('$(VCTargetsPath)\Platforms\x64\PlatformToolsets\v140\ImportBefore')"
/>
<PropertyGroup>
<PlatformToolsetVersion>90</PlatformToolsetVersion>
<VSInstallDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS@ProductDir)</VSInstallDir>
<VSInstallDir Condition=
"'$(VSInstallDir)' == ''"
>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS@ProductDir)</VSInstallDir>
<VSInstallDir Condition=
"'$(VSInstallDir)' == ''"
>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress\10.0\Setup\VS@ProductDir)</VSInstallDir>
<VSInstallDir Condition=
"'$(VSInstallDir)' == ''"
>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VCExpress\10.0\Setup\VS@ProductDir)</VSInstallDir>
<VCInstallDir>E:\Visual Studio 2015 Enterprise\VC\</VCInstallDir>
<MyARXDir>C:\ObjectARX 2017\</MyARXDir>
<MyPlatform>x64</MyPlatform>
<WindowsSdkDir Condition=
"'$(WindowsSdkDir)' == ''"
>G:\Program Files (x86)\Windows Kits\10\</WindowsSdkDir>
<FrameworkDir Condition=
"'$(UseEnv)' != 'true'"
>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework@InstallRoot)</FrameworkDir>
<FrameworkDir Condition=
"'$(FrameworkDir)' == ''"
>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework@InstallRoot)</FrameworkDir>
<FrameworkSdkDir Condition=
"'$(UseEnv)' != 'true'"
>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A@InstallationFolder)</FrameworkSdkDir>
<FrameworkSdkDir Condition=
"'$(FrameworkSdkDir)' == ''"
>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder)</FrameworkSdkDir>
<FrameworkSdkDir Condition=
"'$(FrameworkSdkDir)' == ''"
>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v6.0A@InstallationFolder)</FrameworkSdkDir>
<FrameworkSdkDir Condition=
"'$(FrameworkSdkDir)' == ''"
>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder)</FrameworkSdkDir>
<FrameworkVersion Condition=
"'$(UseEnv)' != 'true'"
>v2.0.50727</FrameworkVersion>
<Framework35Version Condition=
"'$(UseEnv)' != 'true'"
>v3.5</Framework35Version>
<ExecutablePath Condition=
"'$(ExecutablePath)' == ''"
>$(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)bin;$(FrameworkSDKDir)lib\win64;$(FrameworkDir)$(FrameworkVersion);$(FxCopDir);$(PATH);</ExecutablePath>
<IncludePath Condition=
"'$(IncludePath)' == ''"
>$(WindowsSdkDir)Include\10.0.15063.0\um;$$(WindowsSdkDir)Include\10.0.15063.0\winrt;$(WindowsSdkDir)Include\10.0.15063.0\ucrt;$(WindowsSdkDir)Include\10.0.15063.0\shared;$(MyARXDir)inc;$(MyARXDir)inc-x64;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)include;</IncludePath>
<ReferencePath Condition=
"'$(ReferencePath)' == ''"
>$(VCInstallDir)atlmfc\lib\amd64;$(VCInstallDir)lib\amd64</ReferencePath>
<LibraryPath Condition=
"'$(LibraryPath)' == ''"
>$(WindowsSdkDir)Lib\10.0.15063.0\um\x64;$(WindowsSdkDir)Lib\10.0.15063.0\ucrt\x64;$(MyARXDir)lib-x64;$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;</LibraryPath>
<SourcePath Condition=
"'$(SourcePath)' == ''"
>$(VCInstallDir)atlmfc\src\mfc;$(VCInstallDir)atlmfc\src\mfcm;$(VCInstallDir)atlmfc\src\atl;$(VCInstallDir)crt\src;</SourcePath>
<ExcludePath Condition=
"'$(ExcludePath)' == ''"
>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)include;$(FrameworkDir)$(FrameworkVersion);$(VCInstallDir)atlmfc\lib\amd64;$(VCInstallDir)lib\amd64;</ExcludePath>
<NativeExecutablePath Condition=
"'$(NativeExecutablePath)' == ''"
>$(VCInstallDir)bin\AMD64;$(VCInstallDir)VCPackages;$(WindowsSdkDir)bin\x64;$(WindowsSdkDir)bin\win64\x64;$(WindowsSdkDir)bin;$(FrameworkDir)\$(FrameworkVersion);$(FrameworkDir)\$(Framework35Version);$(PATH);</NativeExecutablePath>
</PropertyGroup>
<Import Project=
"$(VCTargetsPath)\Platforms\x64\PlatformToolsets\v140\ImportAfter\*.props"
Condition=
"Exists('$(VCTargetsPath)\Platforms\x64\PlatformToolsets\v140\ImportAfter')"
/>
</Project>
|