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
Determines the C++ language standard the compiler enables. Use the latest version when possible. Sets [`/std:c++14`, `/std:c++17`, `/std:c++latest`](std-specify-language-standard-version.md).
338
+
Determines the C++ language standard the compiler enables. Use the latest version when possible. Sets [`/std:c++14`](std-specify-language-standard-version.md), [`/std:c++17`](std-specify-language-standard-version.md), [`/std:c++20`](std-specify-language-standard-version.md), or [`/std:c++latest`](std-specify-language-standard-version.md).
Copy file name to clipboardExpand all lines: docs/build/reference/experimental-module.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Enables experimental compiler support for Standard Template Library named module
15
15
16
16
## Remarks
17
17
18
-
You can enable experimental modules support by use of the **`/experimental:module`** compiler option along with the [/std:c++latest](std-specify-language-standard-version.md) option. Use **`/experimental:module-`** to disable module support explicitly.
18
+
You can enable experimental modules support by use of the **`/experimental:module`** compiler option along with the [`/std:c++20`](./reference/std-specify-language-standard-version.md)or later option. (In versions before Visual Studio 2019 version 16.11, use **`/std:c++latest`**.) Use **`/experimental:module-`** to disable module support explicitly.
19
19
20
20
This option is available starting in Visual Studio 2015 Update 1. As of Visual Studio 2019 version 16.2, Draft C++20 Standard modules aren't fully implemented in the Microsoft C++ compiler. You can use the modules feature to create single-partition modules and to import the Standard Library modules provided by Microsoft. A module and the code that consumes it must be compiled with the same compiler options.
Copy file name to clipboardExpand all lines: docs/build/reference/general-property-page-project.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,7 @@ To programmatically access this property, see <xref:Microsoft.VisualStudio.VCPro
113
113
114
114
### C++ Language Standard
115
115
116
-
Specifies which C++ language standard to use. The default is **`/std:c++14`**. Specify **`/std:c++17`** to use C++17 features, and **`/std:c++latest`** to use C++20 or other experimental features. For more information, see [`/std` (Specify language standard version)](std-specify-language-standard-version.md)
116
+
Specifies which C++ language standard to use. The default is **`/std:c++14`**. Specify **`/std:c++17`** to use C++17 features, **`/std:c++20`** to use C++20 features, and **`/std:c++latest`** to use C++23 or other experimental features. For more information, see [`/std` (Specify language standard version)](std-specify-language-standard-version.md)
Copy file name to clipboardExpand all lines: docs/build/reference/headername.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,9 +23,9 @@ The name of a header file that the compiler should compile into a header unit (*
23
23
24
24
## Remarks
25
25
26
-
The **`/headerName`** compiler option is available starting in Visual Studio 2019 version 16.10 preview 2.
26
+
The **`/headerName`** compiler option is available starting in Visual Studio 2019 version 16.10.
27
27
28
-
The **`/headerName`** compiler option, in all its forms, requires the [/std:c++latest](std-specify-language-standard-version.md) option.\
28
+
The **`/headerName`** compiler option, in all its forms, requires the [`/std:c++20`](std-specify-language-standard-version.md)or later compiler option (such as **`/std:c++latest`**).\
29
29
If you specify **`/headerName:{quote,angle}`**, you must also specify [`/exportHeader`](module-exportheader.md).
30
30
31
31
**`/headerName:quote`** looks up *`header-filename`* using the same rules as `#include "header-name"` and builds it as a header unit (*`.ifc`* file).\
@@ -39,14 +39,14 @@ Given a project that references a header file it defines called `m.h`, the compi
You can specify multiple `/headerName`switches on the same command line, and every argument after that switch will be processed with the specified *`header-filename`* lookup rules. The following example processes all the headers as the previous two command line examples in the same way. It looks up the headers using the lookup rules applied as if they had been specified as: `#include <vector>`, `#include "my-utilties.h"`, and `#include "a/b/my-core.h"`:
49
+
You can specify multiple `/headerName`options on the same command line, and every argument after that option will be processed with the specified *`header-filename`* lookup rules. The following example processes all the headers as the previous two command line examples in the same way. It looks up the headers using the lookup rules applied as if they had been specified as: `#include <vector>`, `#include "my-utilties.h"`, and `#include "a/b/my-core.h"`:
### To set this compiler option in the Visual Studio development environment
56
56
57
57
> [!NOTE]
58
-
> Users don't typically set this command line switch. It is set by the build system.
58
+
> Users don't typically set this command line option. It's set by the build system.
59
59
60
60
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
Copy file name to clipboardExpand all lines: docs/build/reference/headerunit.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,11 +27,11 @@ The name of a file that contains compiled header unit information. To import mor
27
27
28
28
## Remarks
29
29
30
-
The **`/headerUnit`** compiler option requires the [/std:c++latest](std-specify-language-standard-version.md) option.
30
+
The **`/headerUnit`** compiler option requires the [`/std:c++20`](std-specify-language-standard-version.md)or later compiler option (such as **`/std:c++latest`**).
31
31
32
32
The **`/headerUnit`** compiler option is available starting in Visual Studio 2019 version 16.10 preview 2.
33
33
34
-
When the compiler comes across `import "file";` or `import <file>;`, this compiler switch helps the compiler find the compiled header unit (*`.ifc`*) for the specified header file. The path to this file can be expressed in three ways:
34
+
When the compiler comes across `import "file";` or `import <file>;`, this compiler option helps the compiler find the compiled header unit (*`.ifc`*) for the specified header file. The path to this file can be expressed in three ways:
35
35
36
36
**`/headerUnit`** looks up the compiled header unit in the current directory, or at the location specified in *`ifc-filename`*.
37
37
@@ -41,7 +41,7 @@ When the compiler comes across `import "file";` or `import <file>;`, this compil
41
41
42
42
The compiler can't map a single *`header-name`* to multiple *`.ifc`* files. While mapping multiple *`header-name`* arguments to a single *`.ifc`* is possible, we don't recommend it. The contents of the *`.ifc`* get imported as if it was only the header specified by *`header-name`*.
43
43
44
-
The compiler implicitly enables the new preprocessor when this switch is used. That is, [`/Zc:preprocessor`](zc-preprocessor.md) is added to the command line by the compiler if any form of `/headerUnit` is specified on the command line. To opt out of the implicit `/Zc:preprocessor`, specify: `/Zc:preprocessor-`
44
+
The compiler implicitly enables the new preprocessor when this option is used. That is, [`/Zc:preprocessor`](zc-preprocessor.md) is added to the command line by the compiler if any form of `/headerUnit` is specified on the command line. To opt out of the implicit `/Zc:preprocessor`, specify: `/Zc:preprocessor-`
45
45
46
46
If you disable the new preprocessor, but a file you compile imports a header unit, the compiler will report an error.
Copy file name to clipboardExpand all lines: docs/build/reference/module-exportheader.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,11 +25,11 @@ The argument to `/exportHeader` is a `/headerName` command-line option that spec
25
25
26
26
**`/exportHeader`** is available starting in Visual Studio 2019 version 16.10 Preview 2.
27
27
28
-
The **`/exportHeader`** compiler option requires you enable the [`/std:c++latest`](std-specify-language-standard-version.md) option.
28
+
The **`/exportHeader`** compiler option requires you enable the [`/std:c++20`](std-specify-language-standard-version.md)or later compiler option (such as **`/std:c++latest`**).
29
29
30
30
One **`/exportHeader`** compiler option can specify as many header-name arguments as your build requires. You don't need to specify them separately.
31
31
32
-
The compiler implicitly enables the new preprocessor when this switch is used. That is, [`/Zc:preprocessor`](zc-preprocessor.md) is added to the command line by the compiler if any form of `/exportHeader` is used on the command line. To opt out of the implicit `/Zc:preprocessor`, use: `/Zc:preprocessor-`
32
+
The compiler implicitly enables the new preprocessor when this option is used. That is, [`/Zc:preprocessor`](zc-preprocessor.md) is added to the command line by the compiler if any form of `/exportHeader` is used on the command line. To opt out of the implicit `/Zc:preprocessor`, use: `/Zc:preprocessor-`
33
33
34
34
By default, the compiler doesn't produce an object file when a header unit is compiled. To produce an object file, specify the **`/Fo`** compiler option. For more information, see [`/Fo` (Object File Name)](fo-object-file-name.md).
35
35
@@ -57,7 +57,7 @@ You normally shouldn't set this in the Visual Studio development environment. It
57
57
58
58
## See also
59
59
60
-
[`/headerName (Build a header unit from the specified header)`](headername.md)\
60
+
[`/headerName (Build a header unit from the specified header)`](headername.md)\
61
61
[`/headerUnit` (Use header unit IFC)](headerunit.md)\
62
62
[`/reference` (Use named module IFC)](module-reference.md)\
63
63
[`/translateInclude` (Translate include directives into import directives)](translateinclude.md)
Copy file name to clipboardExpand all lines: docs/build/reference/module-reference.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ A valid name of an exported primary module interface unit name or full module pa
26
26
27
27
In most cases you won't need to specify this switch because the project system discovers module dependencies within a solution automatically.
28
28
29
-
The **`/reference`** compiler option requires you enable the [/std:c++latest](std-specify-language-standard-version.md) option. The **`/reference`** option is available starting in Visual Studio 2019 version 16.10 Preview 2.
29
+
The **`/reference`** compiler option requires you enable the [`/std:c++20`](std-specify-language-standard-version.md)or later compiler option (such as **`/std:c++latest`**). The **`/reference`** option is available starting in Visual Studio 2019 version 16.10.
30
30
31
31
If the **`/reference`** argument is a *`filename`* without a *`module-name`*, the file gets opened at runtime to verify the *`filename`* argument names a specific import. It can result in slower runtime performance in scenarios that have many **`/reference`** arguments.
Copy file name to clipboardExpand all lines: docs/build/reference/permissive-standards-conformance.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,9 @@ The **`/permissive-`** option is supported in Visual Studio 2017 and later. **`/
21
21
22
22
You can use the **`/permissive-`** compiler option to specify standards-conforming compiler behavior. This option disables permissive behaviors, and sets the [`/Zc`](zc-conformance.md) compiler options for strict conformance. In the IDE, this option also makes the IntelliSense engine underline non-conforming code.
23
23
24
-
The **`/permissive-`** option uses the conformance support in the current compiler version to determine which language constructs are non-conforming. The option doesn't determine if your code conforms to a specific version of the C++ standard. To enable all implemented compiler support for the latest draft standard, use the [`/std:c++latest`](std-specify-language-standard-version.md) option. To restrict the compiler support to the currently implemented C++17 standard, use the [`/std:c++17`](std-specify-language-standard-version.md) option. To restrict the compiler support to more closely match the C++14 standard, use the [`/std:c++14`](std-specify-language-standard-version.md) option, which is the default.
24
+
The **`/permissive-`** option uses the conformance support in the current compiler version to determine which language constructs are non-conforming. The option doesn't determine if your code conforms to a specific version of the C++ standard. To enable all implemented compiler support for the latest draft standard, use the [`/std:c++latest`](std-specify-language-standard-version.md) option. To restrict the compiler support to the currently implemented C++20 standard, use the [`/std:c++20`](std-specify-language-standard-version.md) option. To restrict the compiler support to the currently implemented C++17 standard, use the [`/std:c++17`](std-specify-language-standard-version.md) option. To restrict the compiler support to more closely match the C++14 standard, use the [`/std:c++14`](std-specify-language-standard-version.md) option, which is the default.
25
25
26
-
Starting in Visual Studio 2019 version 16.8, the **`/std:c++latest`** option implicitly sets the **`/permissive-`**option. It's required for C++20 Modules support. Perhaps your code doesn't need modules support but requires other features enabled under **`/std:c++latest`**. You can explicitly enable Microsoft extension support by using the **`/permissive`** option without the trailing dash.
26
+
The **`/permissive-`** option is implicitly set by the **`/std:c++latest`** option starting in Visual Studio 2019 version 16.8, and in version 16.11 by the **`/std:c++20`** option. **`/permissive-`**is required for C++20 Modules support. Perhaps your code doesn't need modules support but requires other features enabled under**`/std:c++20`** or**`/std:c++latest`**. You can explicitly enable Microsoft extension support by using the **`/permissive`** option without the trailing dash.
27
27
28
28
By default, the **`/permissive-`** option is set in new projects created by Visual Studio 2017 version 15.5 and later versions. It's not set by default in earlier versions. When the option is set, the compiler generates diagnostic errors or warnings when non-standard language constructs are detected in your code. These constructs include some common bugs in pre-C++11 code.
29
29
@@ -261,7 +261,7 @@ auto y = cond ? 7 : int(a);
261
261
auto z = cond ? A(7) : a;
262
262
```
263
263
264
-
There's an important exception to this common pattern when T represents one of the null-terminated string types (for example, `const char *`, `const char16_t *`, and so on) and the actual argument to `?:` is a string literal of corresponding type. C++17 has changed semantics from C++14. As a result, the code in example 2 is accepted under **`/std:c++14`** and rejected under **`/std:c++17`** when **`/Zc:ternary`** or **`/permissive-`** is used.
264
+
There's an important exception to this common pattern when T represents one of the null-terminated string types (for example, `const char *`, `const char16_t *`, and so on) and the actual argument to `?:` is a string literal of corresponding type. C++17 has changed semantics from C++14. As a result, the code in example 2 is accepted under **`/std:c++14`** and rejected under **`/std:c++17`**or later when **`/Zc:ternary`** or **`/permissive-`** is used.
# `/sourceDependencies:directives` (List module and header unit dependencies)
11
11
12
-
This command-line switch generates a JSON file that lists module and header-unit dependencies.
12
+
This command-line option generates a JSON file that lists module and header-unit dependencies.
13
13
14
14
It identifies which modules and header units need to be compiled before the project that uses them is compiled. For instance, it will list `import <library>;` or `import "library";` as a header unit dependency, and `import name;` as a module dependency.
15
15
16
16
This command-line option is similar to [`/sourceDependencies`](sourcedependencies.md), but differs in the following ways:
17
17
18
18
- The compiler doesn't produce compiled output. Instead, the files are scanned for module directives. No compiled code, modules, or header units are produced.
19
-
- The output JSON file doesn't list imported modules and imported header units (*`.ifc`* files) because this switch does a scan of the project files, not a compilation. So there are no built modules or header units to list.
19
+
- The output JSON file doesn't list imported modules and imported header units (*`.ifc`* files) because this option does a scan of the project files, not a compilation. So there are no built modules or header units to list.
20
20
- Only directly imported modules or header units are listed. It doesn't list the dependencies of the imported modules or header units themselves.
21
21
- Header file dependencies are not listed. That is, `#include <file>` or `#include "file"` dependencies are not listed.
22
22
-`/sourceDependencies:directives` is meant to be used before *`.ifc`* files are built.
0 commit comments