12

I want to generate assembly code from C++ source code using Microsoft VC++ Compiler. I want to do this in the command line itself. Not from the IDE.

What're the commands/options?

pnuts
  • 58,317
  • 11
  • 87
  • 139
Nawaz
  • 353,942
  • 115
  • 666
  • 851

2 Answers2

13

I believe this is what the /FA switch is for.

Oswald
  • 31,254
  • 3
  • 43
  • 68
  • 2
    You may also want `/c` (compile but not link) and if you really don't want the `.obj` file too then you can use `/Fonul` to redirect that away to nul (but it'll still spend time building it, I think). – Rup Dec 21 '10 at 12:34
6

in http://msdn.microsoft.com/en-us/library/367y26c6.aspx

You can use "/FA /Fa" options you can use..

In there documents,

CL /FAcs HELLO.CPP

/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.