1 Windows Kit位置
C:\Program Files (x86)\Windows Kits\10
2 VS2019中build脚本位置
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\
3 vcvars
vcvarsall.bat [architecture] [platform_type] [winsdk_version] [-vcvars_ver=vcversion] [spectre_mode]
各个参数介绍如下:
3.1 architecture
architecture Compiler Host computer architecture Build output (target) architecture
x86 x86 32-bit native x86, x64 x86
x86_amd64 or x86_x64 x64 on x86 cross x86, x64 x64
x86_arm ARM on x86 cross x86, x64 ARM
x86_arm64 ARM64 on x86 cross x86, x64 ARM64
amd64 or x64 x64 64-bit native x64 x64
amd64_x86 or x64_x86 x86 on x64 cross x64 x86
amd64_arm or x64_arm ARM on x64 cross x64 ARM
amd64_arm64 or x64_arm64 ARM64 on x64 cross x64 ARM64
3.2 platform_type
store or uwp
3.3 winsdk_version
10.0.10240.0 或者 8.1 使用Windows 8.1 SDK
10.0.18362.0 使用Windows 10
3.4 vcversion
-vcvars_ver=14.2x.yyyyy 指定vs2019编译工具集
-vcvars_ver=14.29 指定vs2019最新的工具集
-vcvars_ver=14.1 vs2017
-vcvars_ver=14.0 vs2015
3.5 spectre_mode
spectre
3.6 应用举例
vcvarsall.bat x64 10.0.17763.0 -vcvars_ver=14.16 //2017
vcvarsall.bat x64 10.0.18362.0 -vcvars_ver=14.26 //2019
3.7 验证
对比环境变量set
4 创建快捷方式
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 10.0.18362.0 -vcvars_ver=14.16
5 _MSC_VER 版本表
MSC 1.0 _MSC_VER == 100
MSC 2.0 _MSC_VER == 200
MSC 3.0 _MSC_VER == 300
MSC 4.0 _MSC_VER == 400
MSC 5.0 _MSC_VER == 500
MSC 6.0 _MSC_VER == 600
MSC 7.0 _MSC_VER == 700
MSVC++ 1.0 _MSC_VER == 800
MSVC++ 2.0 _MSC_VER == 900
MSVC++ 4.0 _MSC_VER == 1000 (Developer Studio 4.0)
MSVC++ 4.2 _MSC_VER == 1020 (Developer Studio 4.2)
MSVC++ 5.0 _MSC_VER == 1100 (Visual Studio 97 version 5.0)
MSVC++ 6.0 _MSC_VER == 1200 (Visual Studio 6.0 version 6.0)
MSVC++ 7.0 _MSC_VER == 1300 (Visual Studio .NET 2002 version 7.0)
MSVC++ 7.1 _MSC_VER == 1310 (Visual Studio .NET 2003 version 7.1)
MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005 version 8.0)
MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008 version 9.0)
MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010 version 10.0)
MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012 version 11.0)
MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013 version 12.0)
MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015 version 14.0)
MSVC++ 14.1 _MSC_VER == 1910 (Visual Studio 2017 version 15.0)
MSVC++ 14.11 _MSC_VER == 1911 (Visual Studio 2017 version 15.3)
MSVC++ 14.12 _MSC_VER == 1912 (Visual Studio 2017 version 15.5)
MSVC++ 14.13 _MSC_VER == 1913 (Visual Studio 2017 version 15.6)
MSVC++ 14.14 _MSC_VER == 1914 (Visual Studio 2017 version 15.7)
MSVC++ 14.15 _MSC_VER == 1915 (Visual Studio 2017 version 15.8)
MSVC++ 14.16 _MSC_VER == 1916 (Visual Studio 2017 version 15.9)
MSVC++ 14.2 _MSC_VER == 1920 (Visual Studio 2019 Version 16.0)
MSVC++ 14.21 _MSC_VER == 1921 (Visual Studio 2019 Version 16.1)
MSVC++ 14.22 _MSC_VER == 1922 (Visual Studio 2019 Version 16.2)
参考
https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170
https://stackoverflow.com/questions/43939301/visual-studio-2017-vcvars-for-toolset-v140