You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/reference/fi-preprocess-output-file-name.md
+31-9Lines changed: 31 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,27 +13,49 @@ Specifies the name of the output file to which the [`/P` (Preprocess to a File)]
13
13
14
14
> **`/Fi`**_`pathname`_
15
15
16
-
####Parameters
16
+
### Parameters
17
17
18
18
*`pathname`*\
19
-
The name and path of the output file produced by the **`/P`** compiler option.
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`*.
20
20
21
21
## Remarks
22
22
23
-
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.
24
24
25
-
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 doesn't require a particular file name extension. However, an extension of ".i" is used if you don't 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.
26
26
27
-
## Example
27
+
###Example
28
28
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.
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:
30
30
31
31
```cmd
32
32
CL /P /FiMYPROCESS.I PROGRAM.CPP
33
33
```
34
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).
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
+
35
57
## See also
36
58
37
-
[MSVC Compiler Options](compiler-options.md)<br/>
38
-
[/P (Preprocess to a File)](p-preprocess-to-a-file.md)<br/>
39
-
[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