You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Microsoft Visual C++ compiler version consists of four fields:
12
12
13
-
M - major version (two digits)\
14
-
N - minor version (two digits)\
15
-
B - build version (five digits)\
16
-
R - revision version
17
-
13
+
M - major version (two digits)\
14
+
N - minor version (two digits)\
15
+
B - build version (five digits)\
16
+
R - revision version
17
+
18
18
Microsoft-specific compiler macros encode these fields as follows:
19
19
20
-
`_MSC_VER = MMNN`\
21
-
`_MSC_FULL_VER = MMNNBBBBB`\
22
-
`_MSC_BUILD = R`
20
+
`_MSC_VER` = MMNN\
21
+
`_MSC_FULL_VER` = MMNNBBBBB\
22
+
`_MSC_BUILD` = R
23
23
24
24
For example, the compiler version for Visual Studio 2022 version 17.9.0 is 19.39.33519. In this case:
25
25
- The major version is 19
26
26
- The minor version is 39
27
27
- The build version is 33519
28
28
- The revision version is 0
29
29
30
-
The macros reflect these values as`_MSC_VER = 1939`, `_MSC_FULL_VER = 193933519` and `_MSC_BUILD` (the revision) is 0.
30
+
The macros reflect these values like so:`_MSC_VER = 1939`, `_MSC_FULL_VER = 193933519` and `_MSC_BUILD` (the revision) is 0.
31
31
32
-
Note: Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`instead as described in [Service releases starting with Visual Studio 2017](#service-releases-starting-with-visual-studio-2017). The same is true for distinguishing Visual Studio 2019 16.10 from 16.11.
32
+
Note: Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and `_MSC_VER`), as do Visual Studio 2019 16.10 from 16.11. To distinguish them, use `_MSC_FULL_VER` as described in [Service releases starting with Visual Studio 2017](#service-releases-starting-with-visual-studio-2017).
33
33
34
34
How these fields change to distinguish between different versions of the compiler varies, as described in the following sections.
35
35
@@ -40,7 +40,7 @@ How these fields change to distinguish between different versions of the compile
40
40
- For major releases, `_MSC_VER` increases by 100. `_MSC_FULL_VER` increases by 10,000,000.
41
41
- For minor releases, `_MSC_VER` increases by 10. `_MSC_FULL_VER` increases by 1,000,000.
42
42
43
-
Note: Visual Studio .NET 2003 was considered a minor release.
43
+
Note: Visual Studio .NET 2003 was considered a minor release.
44
44
45
45
### Visual Studio 2017 and later
46
46
@@ -51,7 +51,7 @@ Note: Visual Studio .NET 2003 was considered a minor release.
51
51
52
52
- Servicing releases can be distinguished using `_MSC_FULL_VER`. The build field (the BBBBB in the MMNNBBBBB version number) typically increases by 1.
53
53
54
-
For example, two cases where `_MSC_FULL_VER` is useful is to distinguish between Visual Studio 2019 16.8 and 16.9, as well as Visual Studio 2019 16.10 and 16.11. That's because those versions share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`.
54
+
For example, two cases where `_MSC_FULL_VER` is useful is to distinguish between Visual Studio 2019 16.8 from 16.9, and Visual Studio 2019 16.10 from 16.11. That's because those versions share the same major and minor versions (and consequently have the same value for`_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`.
55
55
56
56
## Version macros
57
57
@@ -62,13 +62,14 @@ N - minor version (two digits)\
62
62
B - build version (five digits)\
63
63
R - revision version
64
64
65
-
[`_MSC_VER`](../preprocessor/predefined-macros.md) distinguishes between different versions of the compiler at a high level. Use it to distinguish between major and minor releases. `_MSC_VER = MMNN`.
65
+
**[`_MSC_VER`](../preprocessor/predefined-macros.md)** distinguishes between different versions of the compiler at a high level. It is of the form `_MSC_VER` = MMNN. Use it to distinguish between major and minor releases.
66
+
67
+
**[`_MSC_FULL_VER`](../preprocessor/predefined-macros.md)** represents the major, minor, and build version of the compiler. It is of the form `_MSC_FULL_VER` = MMNNBBBBB. Use it to distinguish between different versions of the compiler, including servicing releases. Because Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and consequently have the same value for `_MSC_VER`), distinguish them using `_MSC_FULL_VER`. The same is true for Visual Studio 2019 16.10 and 16.11.
66
68
67
-
[`_MSC_FULL_VER`](../preprocessor/predefined-macros.md) represents the major, minor, and build version of the compiler. That is, `_MSC_FULL_VER = MMNNBBBBB`. Use it to distinguish between different versions of the compiler, including servicing releases. Because Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and `_MSC_VER`), distinguish them using `_MSC_FULL_VER`. The same is true for Visual Studio 2019 16.10 and 16.11.
69
+
**[`_MSC_BUILD`](../preprocessor/predefined-macros.md)** represents the build version of the compiler. It is of the form `_MSC_BUILD` = R. Use it to distinguish between servicing releases.
68
70
69
-
[`_MSC_BUILD`](../preprocessor/predefined-macros.md) represents the build version of the compiler. `_MSC_BUILD = R`. Use it to distinguish between servicing releases.
71
+
When the major version changed between Visual Studio 2013 and Visual Studio 2015, `_MSC_VER` reflected the change by going from 1800 to 1900.
70
72
71
-
When the major version changed between Visual Studio 2013 and Visual Studio 2015, `_MSC_VER` reflected the change by going from 1800 to 1900.\
72
73
An example of a minor change is from Visual Studio 2022 17.1 to Visual Studio 2022 17.2. In that case, `_MSC_VER` changed from 1931 to 1932.
73
74
74
75
The following table lists the Visual C++ compiler `_MSC_VER` for each Visual Studio release:
@@ -113,9 +114,9 @@ The following table lists the Visual C++ compiler `_MSC_VER` for each Visual Stu
113
114
| Visual Studio 2022 version 17.9 | 1939 |
114
115
| Visual Studio 2022 version 17.10 | 1940 |
115
116
116
-
<sup>a</sup> Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.8 is 192829333. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.9 is 192829910.
117
+
<sup>a</sup> Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and consequently have the same value for `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.8 is 192829333. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.9 is 192829910.
117
118
118
-
<sup>b</sup> Visual Studio 2019 16.10 and 16.11 share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.10 is 192929917. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.11 is 192930129.
119
+
<sup>b</sup> Visual Studio 2019 16.10 and 16.11 share the same major and minor versions (and consequently have the same value for `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.10 is 192929917. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.11 is 192930129.
Copy file name to clipboardExpand all lines: docs/preprocessor/predefined-macros.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,12 +240,14 @@ MSVC supports other predefined macros:
240
240
241
241
- `_MANAGED` Defined as 1 when the [`/clr`](../build/reference/clr-common-language-runtime-compilation.md) compiler option is set. Otherwise, undefined.
242
242
243
-
- `_MSC_BUILD` Defined as an integer literal that contains the revision number element of the compiler's version number. The revision number is the fourth element of the period-delimited version number. For example, if the version number of the Microsoft C/C++ compiler is 15.00.20706.01, the `_MSC_BUILD` macro evaluates to 1. This macro is always defined.
243
+
- `_MSC_BUILD` Defined as an integer literal that contains the revision number element of the compiler's version number. The revision number is the last element of the period-delimited version number. For example, if the version number of the Microsoft C/C++ compiler is 15.00.20706.01, the `_MSC_BUILD` macro evaluates to 1. This macro is always defined.
244
244
245
245
- `_MSC_EXTENSIONS` Defined as 1 if the on-by-default [**`/Ze`** (Enable Language Extensions)](../build/reference/za-ze-disable-language-extensions.md) compiler option is set. Otherwise, undefined.
246
246
247
247
- `_MSC_FULL_VER` Defined as an integer literal that encodes the major, minor, and build number elements of the compiler's version number. The major number is the first element of the period-delimited version number, the minor number is the second element, and the build number is the third element. For example, if the Microsoft C/C++ compiler version is 19.39.33519, `_MSC_FULL_VER` evaluates to 193933519. Enter `cl /?` at the command line to view the compiler's version number. This macro is always defined.\
248
+
248
249
Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for 16.8 is 192829333. The minimum value of `_MSC_FULL_VER` for 16.9 is 192829910.\
250
+
249
251
Visual Studio 2019 16.10 and 16.11 also share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for 16.10 is 192929917. The minimum value of `_MSC_FULL_VER` for 16.11 is 192930129.
250
252
251
253
- `_MSC_VER` Defined as an integer literal that encodes the major and minor number elements of the compiler's version number. The major number is the first element of the period-delimited version number and the minor number is the second element. For example, if the version number of the Microsoft C/C++ compiler is 17.00.51106.1, the `_MSC_VER` macro evaluates to 1700. Enter `cl /?` at the command line to view the compiler's version number. This macro is always defined.
@@ -264,8 +266,9 @@ MSVC supports other predefined macros:
264
266
#endif
265
267
```
266
268
267
-
To test for compiler versions that share major and minor numbers, use the major, minor, and build numbers in `_MSC_FULL_VER` for comparisons. `_MSC_FULL_VER` for Visual Studio 2019 16.8 is 192829333. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.9 is 192829910.
268
-
Visual Studio 2019 16.10 and 16.11 also share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.10 is 192929917. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.11 is 192930129.
269
+
Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and consequently have the same value for `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.8 is 192829333. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.9 is 192829910.
270
+
271
+
Visual Studio 2019 16.10 and 16.11 share the same major and minor versions (and consequently have the same value for `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.10 is 192929917. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.11 is 192930129.
269
272
270
273
For more information about compiler versioning, see [Visual C++ Compiler Version](https://devblogs.microsoft.com/cppblog/visual-c-compiler-version/) in the Microsoft C++ Team Blog.
0 commit comments