/experimental:module (Enable module support)

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. It's still required (along with /std:c++latest) for the experimental Standard library modules.

Syntax

/experimental:module[-]

Remarks

In versions of Visual Studio before Visual Studio 2019 version 16.11, you can enable experimental modules support by use of the /experimental:module compiler option along with the /std:c++latest 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 module support explicitly.

This option is available starting in Visual Studio 2015 Update 1. As of Visual Studio 2019 version 16.2, C++20 Standard modules aren't fully implemented in the Microsoft C++ compiler. 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. 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++.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.

  2. Set the Configuration drop-down to All Configurations.

  3. Select the Configuration Properties > C/C++ > Language property page.

  4. Modify the Enable C++ Modules (experimental) property, and then choose OK.

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)