|
| 1 | +--- |
| 2 | +title: "/ifcOutput" |
| 3 | +description: "Specify output file or directory for `.ifc` files." |
| 4 | +ms.date: 11/21/2022 |
| 5 | +author: "tylermsft" |
| 6 | +ms.author: "twhitney" |
| 7 | +f1_keywords: ["/ifcOutput", "VC.Project.VCCLCompilerTool.ifcOutput"] |
| 8 | +helpviewer_keywords: ["/ifcOutput", "Specify where the compiled `.ifc` should go"] |
| 9 | +--- |
| 10 | +# `/ifcOutput` |
| 11 | + |
| 12 | +This switch tells the compiler where to output built *`.ifc`* files. If the destination is a directory, then the compiler generates the name of each `.ifc` file based on the interface name or the header unit name. |
| 13 | + |
| 14 | +## Syntax |
| 15 | + |
| 16 | +> **`/ifcOutput`** *`filename`*\ |
| 17 | +> **`/ifcOutput`** *`directory\`* |
| 18 | +
|
| 19 | +## Remarks |
| 20 | + |
| 21 | +By default, the compiler derives the name for each generated *`.ifc`* file from the module interface name. For example, given a module name `MyModule`, the generated *`.ifc`* will be named *`MyModule.ifc`*, unless you override the name with the `/ifcOutput` switch. |
| 22 | + |
| 23 | +Use this switch to specify an alternative *`.ifc`* filename or directory. If you want to use the default built *`.ifc`* filenames, but specify a directory where they should be built, ensure that you add a trailing backslash (`\`) to the directory name. |
| 24 | + |
| 25 | +When you're building multiple *`.ifc`* files, only use the directory form of the `/ifcOutput` switch. If you provide multiple `/ifcOutput` switches, the compiler only uses the last one. |
| 26 | + |
| 27 | +If you build with the [`/MP` (Build with multiple processes)](mp-build-with-multiple-processes.md) switch, we recommend that you use the directory form of the `/ifcOutput` switch if you have multiple input module files. |
| 28 | + |
| 29 | +In the following example, the *`.ifc`* file for module `m` defined in *`m.ixx`* is built as `c:\example\m.ifc`. |
| 30 | + |
| 31 | +```bash |
| 32 | +cl ... /c /std:c++latest m.ixx /ifcOutput c:\example\ |
| 33 | +``` |
| 34 | + |
| 35 | +In the following example, the built *`.ifc`* file for module `m` defined in *`m.ixx`** is built as `c:\example\MyModule.ifc`: |
| 36 | + |
| 37 | +```bash |
| 38 | +cl ... /c /std:c++latest m.ixx /ifcOutput c:\example\MyModule.ifc |
| 39 | +``` |
| 40 | + |
| 41 | +### To set this compiler option in the Visual Studio development environment |
| 42 | + |
| 43 | +1. To apply the **`/ifcOutput`** option to one file in the IDE, select the file in **Solution Explorer**. Right-click to open the context menu and select **Properties** to open the **Property Pages** dialog. |
| 44 | + |
| 45 | +1. Set the **Configuration** dropdown to **All Configurations**. Set the **Platform** dropdown to **All Platforms**. |
| 46 | + |
| 47 | +1. Open the **Configuration Properties** > **C/C++** > **Output Files** property page. |
| 48 | + |
| 49 | +1. Use the dropdown control to modify the **Module Output File Name** property to a directory name (ending in `\`) or an alternate file name. Or you can specify a directory + file name, for example, `c:\example\mymodule.ifc`. Choose **OK** or **Apply** to save your changes. |
| 50 | + |
| 51 | +Alternatively, you can specify the `/ifcOutput` switch with a right-click on the project name in the **Solution Explorer** > **Configuration Properties** > **C/C++** > **Command Line**. |
| 52 | + |
| 53 | +## See also |
| 54 | + |
| 55 | +[Overview of modules in C++](../../cpp/modules-cpp.md)\ |
| 56 | +[Using C++ Modules in MSVC from the Command Line](https://devblogs.microsoft.com/cppblog/using-cpp-modules-in-msvc-from-the-command-line-part-1/) |
0 commit comments