This switch instructs the compiler to treat
import for header files that have been built into header unit (
.ifc) files and that are specified on the command line with
When used with
/sourceDependencies-directives, the compiler lists as imported header units in the generated dependency file those headers that are both included in the source and have a corresponding entry in a
header-units.json file. This dependency info is used by the build system to generate compiled header unit
.ifc files. Once the header units are built, they're treated by the compiler as an
import instead of an
header-units.json file is only consulted when
/translateInclude is specified. For more information about the format and purpose of the
header-units.json file, see
#include file isn't listed in the
header-units.json file, it's treated as a normal
For an example of how this switch is used, see Walkthrough: Build and import header units in Microsoft Visual C++.
/translateInclude is available in Visual Studio 2019 version 16.10, or later.
/translateInclude requires /std:c++20 or later.
To set this compiler option in Visual Studio
/translateInclude, in the project properties dialog, set Translate Includes to Imports:
In the left-hand pane of the project property pages, select Configuration Properties > C/C++ > General.
Change the Translate Includes to Imports dropdown to Yes.
Choose OK or Apply to save your changes.
/headerUnit (Use header unit IFC).
/exportHeader (Create header units)
/reference (Use named module IFC)
Walkthrough: Build and import header units in Microsoft Visual C++