| title | /experimental:module (Enable module support) | |||
|---|---|---|---|---|
| description | Use the /experimental:module compiler option to enable experimental compiler support for modules. | |||
| ms.date | 09/03/2019 | |||
| f1_keywords |
|
|||
| helpviewer_keywords |
|
Enables experimental compiler support for modules, as specified by the draft C++20 standard.
/experimental:module[-]
You can enable experimental modules support by use of the /experimental:module compiler option along with the /std:c++latest option. You can use /experimental:module- to disable module support explicitly.
This option is available starting in Visual Studio 2015 Update 1. As of Visual Studio 2019 version 16.2, Draft C++20 Standard modules are not 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.
For more information on modules and how to use and create them, see Overview of modules in C++.
Here's an example of the compiler command-line options used to create an export module from source file ModuleName.ixx:
cl /EHsc /MD /experimental:module /module:export /module:name ModuleName /module:wrapper C:\Output\path\ModuleName.h /module:output C:\Output\path\ModuleName.ifc -c ModuleName.ixx-
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.