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 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 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.
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).
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).
21
+
18
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.
19
23
20
-
This compiler switch is available starting in Visual Studio 2015 Update 1. Modules support is feature complete in Visual Studio 2019 version 16.10. You can use the modules feature import the Standard Library modules provided by Microsoft. The new, standardized, way of consuming the C++ Standard Library as modules is described in [Import the C++ standard library using modules](tutorial-import-stl-named-module.md).
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.
21
25
22
26
For more information about how to use and create modules, see [Overview of modules in C++](../../cpp/modules-cpp.md).
23
27
@@ -36,7 +40,7 @@ import std.core;
36
40
import std.regex;
37
41
```
38
42
39
-
To consume the experimental Microsoft Standard Library modules, compile your program with the [`/EHsc`](../build/reference/eh-exception-handling-model.md) and [`/MD`](../build/reference/md-mt-ld-use-run-time-library.md) options.
43
+
To consume the experimental Microsoft Standard Library modules, compile your program with the [`/EHsc`](eh-exception-handling-model.md) and [`/MD`](md-mt-ld-use-run-time-library.md) options.
40
44
41
45
### To set this compiler option in the Visual Studio development environment
Copy file name to clipboardExpand all lines: docs/cpp/tutorial-named-modules-cpp.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "Named modules tutorial in C++"
3
-
ms.date: 08/08/2022
3
+
ms.date: 02/12/2025
4
4
ms.topic: "tutorial"
5
5
author: "tylermsft"
6
6
ms.author: "twhitney"
@@ -237,7 +237,7 @@ int main()
237
237
}
238
238
```
239
239
240
-
The statement `import BasicPlane.Figures;` makes all the exported functions and types from the `BasicPlane.Figures` module visible to this file. It can come before or after any `#include` directives.
240
+
The statement `import BasicPlane.Figures;` makes all the exported functions and types from the `BasicPlane.Figures` module visible to this file. It should come after any `#include` directives.
241
241
242
242
The app then uses the types and functions from the module to output the area and width of the defined rectangle:
243
243
@@ -265,7 +265,7 @@ module; // optional. Defines the beginning of the global module fragment
265
265
266
266
// #include directives go here but only apply to this file and
267
267
// aren't shared with other module implementation files.
268
-
// Macro definitions aren't visible outside this file, or to importers.
268
+
// Macro definitions aren't visible outside this file or to importers.
269
269
// import statements aren't allowed here. They go in the module preamble, below.
270
270
271
271
exportmodule [module-name]; // Required. Marks the beginning of the module preamble
@@ -305,7 +305,8 @@ Module implementation units are useful for breaking up a large module into small
305
305
Module implementation unit files have a *`.cpp`* extension. The basic outline of a module implementation unit file is:
306
306
307
307
```cpp
308
-
// optional #include or import statements. These only apply to this file
308
+
// optional #include statements. These only apply to this file
309
+
// optional import statements. These only apply to this file
309
310
// imports in the associated module's interface are automatically available to this file
310
311
311
312
module [module-name]; // required. Identifies which named module this implementation unit belongs to
0 commit comments