/experimental:module
(Enable experimental module support)
Enables compiler support for Microsoft's experimental form of C++ Standard modules. This option is obsolete in Visual Studio 2019 version 16.11 and later.
Syntax
/experimental:module
[-
]
Remarks
This switch was for the time before the new, standardized, way of consuming the C++ Standard Library as modules described in Import the C++ standard library using modules was available. Although you can use this switch to use the older experimental named modules, we recommend that you use the new, standardized, way of consuming the C++ Standard Library as modules described in Import the C++ standard library using modules.
This compiler became 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 and C++ support in Visual Studio.
Version | Status |
---|---|
Visual Studio 2015 Update 1 | /experimental:module introduced. |
Visual Studio 2019 version 16.10 | C++20 modules support is feature complete. |
Visual Studio 2019 16.11 and earlier | Enable experimental modules support using /experimental:module along with /std:c++latest . |
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. |
The experimental library consists of the following named modules:
std.regex
provides the content of header<regex>
std.filesystem
provides the content of header<filesystem>
std.memory
provides the content of header<memory>
std.threading
provides the contents of headers<atomic>
,<condition_variable>
,<future>
,<mutex>
,<shared_mutex>
, and<thread>
std.core
provides everything else in the C++ Standard Library
To consume these modules, add an import declaration to the top of the source code file. For example:
import std.core;
import std.regex;
To consume the experimental Microsoft Standard Library modules, compile your program with the /EHsc
and /MD
options.
To set this compiler option in the Visual Studio development environment
- Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.
- Set the Configuration drop-down to All Configurations.
- Select the Configuration Properties > C/C++ > Language property page.
- Modify the Enable C++ Modules (experimental) property, and then choose OK.
For more information about how to use and create modules, see Overview of modules in C++.
See also
/headerUnit
(Use header unit IFC)
/exportHeader
(Create header units)
/reference
(Use named module IFC)
/translateInclude
(Translate include directives into import directives)
/Zc
(Conformance)