|
1 | 1 | --- |
2 | 2 | title: "/Fi (Preprocess Output File Name)" |
3 | | -ms.date: "11/04/2016" |
| 3 | +ms.date: 08/12/2020 |
4 | 4 | f1_keywords: ["/Fi"] |
5 | 5 | helpviewer_keywords: ["Fi compiler option (C++)", "-Fi compiler option (C++)", "/Fi compiler option (C++)", "preprocessing output files, file name"] |
6 | 6 | ms.assetid: 6d0ba983-a8b7-41ec-84f5-b4688ef8efee |
7 | 7 | --- |
8 | | -# /Fi (Preprocess Output File Name) |
| 8 | +# `/Fi` (Preprocess output file name) |
9 | 9 |
|
10 | | -Specifies the name of the output file to which the [/P (Preprocess to a File)](p-preprocess-to-a-file.md) compiler option writes preprocessed output. |
| 10 | +Specifies the name of the output file to which the [`/P` (Preprocess to a File)](p-preprocess-to-a-file.md) compiler option writes preprocessed output. |
11 | 11 |
|
12 | 12 | ## Syntax |
13 | 13 |
|
14 | | -``` |
15 | | -/Fipathname |
16 | | -``` |
| 14 | +> **`/Fi`**_`pathname`_ |
17 | 15 |
|
18 | | -#### Parameters |
| 16 | +### Parameters |
19 | 17 |
|
20 | | -|Parameter|Description| |
21 | | -|---------------|-----------------| |
22 | | -|`pathname`|The name and path of the output file produced by the **/P** compiler option.| |
| 18 | +*`pathname`*\ |
| 19 | +The relative or absolute path and filename of the output file produced by the **`/P`** compiler option. Or, the directory path for the *`.i`* output files when more than one input file is specified. Don't put a space between the **`/Fi`** option and *`pathname`*. |
23 | 20 |
|
24 | 21 | ## Remarks |
25 | 22 |
|
26 | | -Use the **/Fi** compiler option in combination with the **/P** compiler option. |
| 23 | +Use the **`/Fi`** compiler option in combination with the **`/P`** compiler option. If **`/P`** isn't specified, **`/Fi`** causes command line warning D9007. |
27 | 24 |
|
28 | | -If you specify only a path for the `pathname` parameter, the base name of the source file is used as the base name of the preprocessed output file. The `pathname` parameter does not require a particular file name extension. However, an extension of ".i" is used if you do not specify a file name extension. |
| 25 | +If you specify only a directory path (a path that ends in a backslash **`\`**) for the *`pathname`* parameter, the base name of the source file is used as the base name of the preprocessed output file. The *`pathname`* parameter doesn't require a particular file name extension. However, an extension of ".i" is used if you don't specify a file name extension. |
29 | 26 |
|
30 | | -## Example |
| 27 | +### Example |
31 | 28 |
|
32 | | -The following command line preprocesses PROGRAM.cpp, preserves comments, adds [#line](../../preprocessor/hash-line-directive-c-cpp.md) directives, and writes the result to the MYPROCESS.i file. |
| 29 | +The following command line preprocesses *`PROGRAM.cpp`*, preserves comments, adds [`#line`](../../preprocessor/hash-line-directive-c-cpp.md) directives, and writes the result to the *`MYPROCESS.i`* file: |
33 | 30 |
|
34 | | -``` |
| 31 | +```cmd |
35 | 32 | CL /P /FiMYPROCESS.I PROGRAM.CPP |
36 | 33 | ``` |
37 | 34 |
|
| 35 | +This command line preprocesses *`main.cpp`* and *`helper.cpp`* into *`main.i`* and *`helper.i`* in a subdirectory named *`preprocessed`*: |
| 36 | + |
| 37 | +```cmd |
| 38 | +CL /P /Fi".\\preprocessed\\" main.cpp helper.cpp |
| 39 | +``` |
| 40 | + |
| 41 | +### To set this compiler option in the Visual Studio development environment |
| 42 | + |
| 43 | +1. Open the source file or the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md). |
| 44 | + |
| 45 | +1. Select the **Configuration Properties** > **C/C++** > **Preprocessor** property page. |
| 46 | + |
| 47 | +1. Set the **Preprocess to a File** property to **Yes**. |
| 48 | + |
| 49 | +1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page. |
| 50 | + |
| 51 | +1. Enter the **`/Fi`** compiler option and *`pathname`* in the **Additional Options** box. Only specify a directory path, not a filename, when setting this property for a project. |
| 52 | + |
| 53 | +### To set this compiler option programmatically |
| 54 | + |
| 55 | +- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>. |
| 56 | + |
38 | 57 | ## See also |
39 | 58 |
|
40 | | -[MSVC Compiler Options](compiler-options.md)<br/> |
41 | | -[/P (Preprocess to a File)](p-preprocess-to-a-file.md)<br/> |
42 | | -[Specifying the Pathname](specifying-the-pathname.md) |
| 59 | +[MSVC compiler options](compiler-options.md)<br/> |
| 60 | +[`/P` (Preprocess to a file)](p-preprocess-to-a-file.md)<br/> |
| 61 | +[Specifying the pathname](specifying-the-pathname.md) |
0 commit comments