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. They're reflected in various Microsoft-specific compiler macros that can be used to distinguish which version of the compiler is compiling your code.
12
-
13
-
The version number consists of four fields:
14
-
15
-
M - major version (two digits)\
16
-
N - minor version (two digits)\
17
-
B - build version (five digits)\
18
-
R - revision version
11
+
The Microsoft Visual C++ compiler version consists of four fields:
19
12
13
+
M - major version (two digits)\
14
+
N - minor version (two digits)\
15
+
B - build version (five digits)\
16
+
R - revision version
17
+
20
18
Microsoft-specific compiler macros encode these fields as follows:
21
19
22
-
`_MSC_VER = MMNN`
23
-
`_MSC_FULL_VER = MMNNBBBBB`
20
+
`_MSC_VER = MMNN`\
21
+
`_MSC_FULL_VER = MMNNBBBBB`\
24
22
`_MSC_BUILD = R`
25
23
26
-
For example, for Visual Studio 2022 version 17.9.0, the compiler version is 19.39.33519. The major version is 19, the minor version is 39, the build version is 33519, and the revision version is 0. In other words, `_MSC_VER` is 1939, `_MSC_FULL_VER` is 193933519, and `_MSC_BUILD` (the revision) is 0.
24
+
For example, the compiler version for Visual Studio 2022 version 17.9.0 is 19.39.33519. In this case:
25
+
- The major version is 19
26
+
- The minor version is 39
27
+
- The build version is 33519
28
+
- The revision version is 0
29
+
30
+
The macros reflect these values as `_MSC_VER = 1939`, `_MSC_FULL_VER = 193933519` and `_MSC_BUILD` (the revision) is 0.
27
31
28
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.
29
33
@@ -47,7 +51,7 @@ Note: Visual Studio .NET 2003 was considered a minor release.
47
51
48
52
- Servicing releases can be distinguished using `_MSC_FULL_VER`. The build field (the BBBBB in the MMNNBBBBB version number) typically increases by 1.
49
53
50
-
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. The reason is that 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 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`.
51
55
52
56
## Version macros
53
57
@@ -60,12 +64,12 @@ R - revision version
60
64
61
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`.
62
66
63
-
[`_MSC_FULL_VER`](../preprocessor/predefined-macros.md) represents the major, minor, and build version of the compiler. `_MSC_FULL_VER = MMNNBBBBB`. Use it used to distinguish between different versions of the compiler, including servicing releases. 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 same is true for Visual Studio 2019 16.10 and 16.11.
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.
64
68
65
-
[`_MSC_BUILD`](../preprocessor/predefined-macros.md) represents the build version of the compiler. `_MSC_BUILD` = R. Use it to distinguish between servicing releases.
69
+
[`_MSC_BUILD`](../preprocessor/predefined-macros.md) represents the build version of the compiler. `_MSC_BUILD = R`. Use it to distinguish between servicing releases.
66
70
67
-
For example, the major version changed between Visual Studio 2013 and Visual Studio 2015, reflected by a change in `_MSC_VER` from 1800 to 1900.\
68
-
An example of a minor change is from Visual Studio 2022 17.1 to Visual Studio 2022 17.2, when`_MSC_VER` changed from 1931 to 1932.
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
+
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.
69
73
70
74
The following table lists the Visual C++ compiler `_MSC_VER` for each Visual Studio release:
Copy file name to clipboardExpand all lines: docs/preprocessor/predefined-macros.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -244,9 +244,10 @@ MSVC supports other predefined macros:
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
-
- `_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
-
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.
249
-
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.
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
+
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.\
249
+
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
+
250
251
- `_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.
251
252
252
253
See [C++ compiler versioning](../overview/compiler-versions.md) for more information about the history of compiler versioning, and compiler version numbers and the Visual Studio versions they correspond to.
0 commit comments