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
Specifies an object (*`.obj`*) file name or directory to be used instead of the default.
12
12
13
13
## Syntax
14
14
15
-
> **`/Fo`**_pathname_
15
+
> **`/Fo`***`pathname`*
16
16
17
17
## Remarks
18
18
19
-
You can use the **`/Fo`** compiler option to set an output directory for all the object files generated by the CL compiler command. Or, you can use it to rename a single object file.
19
+
You can use the **`/Fo`** compiler option to set an output directory for all the object files generated by the CL compiler command. Or, you can use it to rename a single object file. Don't put a space between the **`/Fo`** option and the *`pathname`* argument.
20
20
21
21
By default, the object files generated by the compiler are placed in the current directory. They're given the base name of the source file and a *`.obj`* extension.
22
22
23
-
To use the **`/Fo`** option to rename an object file, specify the output filename as the *pathname* argument. When you rename an object file, you can use any name and extension you want, but the recommended convention is to use *`.obj`*. The compiler generates command line error D8036 if you specify a filename to **`/Fo`** when you've specified more than one source file to compile.
23
+
To use the **`/Fo`** option to rename an object file, specify the output filename as the *`pathname`* argument. When you rename an object file, you can use any name and extension you want, but the recommended convention is to use an *`.obj`* extension. The compiler generates command line error D8036 if you specify a filename to **`/Fo`** when you've specified more than one source file to compile.
24
24
25
-
To use the **`/Fo`** option to set an output directory for all object files created by the CL command, specify the directory as the *pathname* argument. A directory is indicated by a trailing slash in the *pathname* argument. The specified directory must exist; it's not created automatically.
25
+
To use the **`/Fo`** option to set an output directory for all object files created by the CL command, specify the directory as the *`pathname`* argument. A directory is indicated by a trailing slash or backslash in the *`pathname`* argument. Use an escaped backslash (a double backslash), if you're using a quoted path. The directory path can be absolute, or relative to the source directory. The specified directory must exist, or the compiler reports error D8003. The directory isn't created automatically.
26
26
27
27
## Example
28
28
29
-
The following command line creates an object file named *sample.obj*in an existing directory, *\\intermediate*, on drive D.
29
+
The following command line creates object files named *`sample1.obj`* and *`sample2.obj`*in an existing directory, *`D:\intermediate\`*. It uses escaped backslash characters as path segment separators in a quoted path:
This command line creates object files named *`sample1.obj`* and *`sample2.obj`* in an existing directory, *`output\`*, relative to the source directory.
36
+
37
+
```cmd
38
+
CL /Fooutput\ /EHsc /c sample1.cpp sample2.cpp
33
39
```
34
40
35
41
## Set the option in Visual Studio or programmatically
0 commit comments