1. Using visual studio 2005 or 2008 :
i. Create simple hellow world win32 console application.
ii. Right click on the file (let's say hello.cpp) in the solution explorer tree.
iii. Select properties.
iv. Expand C/C++ in left side tree of the window raised.
v. Click on output files under C/C++
vi. On right side of the dialog see entry in table "Assembler output", select option "Assembly with source code (/FAs)"
vii. Select OK to close this dialog.
viii. Use F7 to build the project.
In the Debug folder of your project Hello.asm (or filename.asm) should be generated.
2. Using Visual C++ 6 :
i. Create simple hello world win32 console application.
ii. Select the file (let's say hello.cpp) in the solution explorer tree
iii. Select Project Menu - Settings.
iv. Select C/C++ tab.
v. In category select "Listing Files" from drop down.
vi. In listing file type: drop down select "Assembly with Source Code"
vii. For Listing file name: write path as Debug/HelloWorld.asm -> this step is must unlike new Visual studio.
viii. Select OK.
viii. Use F7 to build the project.
In the Debug folder of your project HelloWorld.asm (or filename.asm) should be generated.
3. Using GCC/ G++:
Very easy compared to visual studio. :)
To generate assembly code for hello.cpp use following command -
g++ -S Hello.cpp -o Hello.S
Note:
The code generated by above options also contains many lines which you might find 'not-relevant'. To read this .asm file is your skill :).