共用方式為


/FA, /Fa (Listing File)

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at /FA, /Fa (Listing File).

Creates a listing file containing assembly code.

Syntax

/FA[c|s|u]  
/Fapathname  

Remarks

The arguments control the generation of source code and machine code and the extension of the listing file.

The following table describes the various values to /FA. It is possible to specify more than one value to /FA. For example, you can specify /FAsu.

Option Listing contents and file extension
/FA Assembly code; .asm
/FAc Machine and assembly code; .cod
/FAs Source and assembly code; .asm

If /FAcs is specified, the file extension will be .cod
/FAu Causes the output file to be created in UTF-8 format, with a byte order marker. By default, the file encoding is ANSI, but use /FAu if you want a listing file that displays correctly on any system, or if you are using Unicode source code files as input to the compiler.

If /FAsu is specified, and if a source code file uses Unicode encoding other than UTF-8, then the code lines in the .asm file may not display correctly.

By default, the listing file gets the same base name as the source file. You can change the name of the listing file and the directory where it is created using the /Fa option.

/Fa usage Result
/Fa One source_file.asm is created for each source code file in the compilation.
/Fa filename filename.asm is placed in the current directory. Only valid when compiling a single source code file.
/Fa filename.extension filename.extension is placed in the current directory. Only valid when compiling a single source code file.
/Fa directory\ One source_file.asm is created and placed in the specified directory for each source code file in the compilation. Note the required trailing backslash. Only paths on the current disk are allowed.
/Fa directory\filename filename.asm is placed in the specified directory. Only valid when compiling a single source code file.
/Fa directory\filename.extension filename.extension is placed in the specified directory. Only valid when compiling a single source code file.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.

  2. Click the C/C++ folder.

  3. Click the Output Files property page.

  4. Modify the ASM List Location (/Fa) or Assembler Output (/FA) property (/FAu must be specified in the Command Line property page, Additional Options box..

To set this compiler option programmatically

Example

The following command line produces a combined source and machine-code listing called HELLO.cod:

CL /FAcs HELLO.CPP  

See Also

Output-File (/F) Options
Compiler Options
Setting Compiler Options
Specifying the Pathname