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
Enables experimental compiler support for C++ Standard modules. This option is obsolete for C++20 standard modules in Visual Studio 2019 version 16.11 and later. This switch is only used (along with [`/std:c++latest`](std-specify-language-standard-version.md)) if you are still using the older experimental Standard library modules. We recommend that you use the new Standard Library modules provided by Microsoft without using this switch.
10
+
Enables compiler support for an experimental form of C++ Standard modules. This option is obsolete in Visual Studio 2019 version 16.11 and later.
11
11
12
12
## Syntax
13
13
14
14
> **`/experimental:module`**\[**`-`**]
15
15
16
16
## Remarks
17
17
18
-
Although you can use this switch to use the older experimental named modules listed below, we recommend that you use the the new, standardized, way of consuming the C++ Standard Library as modules described in [Import the C++ standard library using modules](../../cpp/tutorial-import-stl-named-module.md).
18
+
Although you can use this switch to use the older experimental named modules, we recommend that you use the the new, standardized, way of consuming the C++ Standard Library as modules described in [Import the C++ standard library using modules](../../cpp/tutorial-import-stl-named-module.md).
19
19
20
-
Before you can use the experimental modules, ensure that **C++ Modules for v143 build tools (x64/x86 - experimental)** in selected the VS Installer. It's available in the **Individual components** tab of the installer. Search for **experimental** to see the option. For more information, see [Install C++ support in Visual Studio](../install/install-visual-cpp.md).
20
+
This compiler switch is available starting in Visual Studio 2015 Update 1. Ensure that **C++ Modules for v143 build tools (x64/x86 - experimental)** in selected the VS Installer. It's available in the **Individual components** tab of the installer. Search for **experimental** to see the option. For more information, see [Install C++ support in Visual Studio](../install/install-visual-cpp.md).
21
21
22
-
In versions of Visual Studio before Visual Studio 2019 version 16.11, you can enable experimental modules support using the **`/experimental:module`** compiler option along with the [`/std:c++latest`](std-specify-language-standard-version.md) option. In Visual Studio 2019 version 16.11, module support is enabled automatically by either **`/std:c++20`** or **`/std:c++latest`**. Use **`/experimental:module-`** to disable experimental module support.
23
-
24
-
This compiler switch is available starting in Visual Studio 2015 Update 1. Modules support is feature complete in Visual Studio 2019 version 16.10.
25
-
26
-
For more information about how to use and create modules, see [Overview of modules in C++](../../cpp/modules-cpp.md).
22
+
| Version | Status |
23
+
|---|---|
24
+
| Visual Studio 2015 Update 1 |`/experimental:module` is available. |
25
+
| Visual Studio 2019 version 16.10 | C++20 modules support is feature complete. |
26
+
| Visual Studio 2019 16.11 and earlier | Enable experimental modules support using **`/experimental:module`** along with [`/std:c++latest`](std-specify-language-standard-version.md). |
27
+
| Visual Studio 2019 version 16.11 and later | Modules support is enabled automatically with **`/std:c++20`** or later, or **`/std:c++latest`**. Use **`/experimental:module-`** to disable experimental module support. |
27
28
28
29
The experimental library consists of the following named modules:
29
30
@@ -49,6 +50,8 @@ To consume the experimental Microsoft Standard Library modules, compile your pro
description: Use import and export declarations to access and to publish types and functions defined in the specified module.
@@ -19,7 +19,7 @@ module ModuleA;
19
19
20
20
## `export`
21
21
22
-
Use an **`export module`** declaration for the module's primary interface file, which must have extension *`.ixx`*:
22
+
Use an **`export module`** declaration for the module's primary interface file, which should have an extension *`.ixx`* by default. If you want to use a different extension, you'll need to use the [/interface](../build/reference/interface.md) switch to compile it as a module interface.
Copy file name to clipboardExpand all lines: docs/cpp/tutorial-named-modules-cpp.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ description: Named modules in C++20 provide a modern alternative to header files
9
9
---
10
10
# Named modules tutorial (C++)
11
11
12
-
This tutorial is about creating C++20 modules. Modules replace header files. You'll learn how modules are an improvement on header files.
12
+
This tutorial is about creating C++20 modules. Modules are a significant improvement on header files.
13
13
14
14
In this tutorial, learn how to:
15
15
@@ -22,13 +22,11 @@ In this tutorial, learn how to:
22
22
23
23
This tutorial requires Visual Studio 2022 17.1.0 or later.
24
24
25
-
You might get IntelliSense errors while working on the code example in this tutorial. Work on the IntelliSense engine is catching up with the compiler. IntelliSense errors can be ignored and won't prevent the code example from building. To track progress on the IntelliSense work, see this [issue](https://developercommunity.visualstudio.com/t/When-importing-a-C20-module-or-header-/1550846).
26
-
27
25
## What are C++ modules
28
26
29
-
Header files are how declarations and definitions are shared between source files in C++. Header files are fragile and difficult to compose. They may compile differently depending on the order you include them in, or on the macros that are or aren't defined. They can slow compilation time because they're reprocessed for each source file that includes them.
27
+
Header files are how declarations and definitions are shared between source files in C++. Header files are fragile and difficult to compose. They may compile differently depending on the order you include them in or on the macros that are or aren't defined. They can slow compilation time because they're reprocessed for each source file that includes them.
30
28
31
-
C++20 introduces a modern approach to componentizing C++ programs: *modules*.
29
+
C++20 introduces *modules* as a modern approach to componentizing C++ programs.
32
30
33
31
Like header files, modules allow you to share declarations and definitions across source files. But unlike header files, modules don't leak macro definitions or private implementation details.
0 commit comments