-3

I'm trying learning assembly language and i need to know how to read the assembly varsion of a c program from the windows 10 command prompt. I've tried using C:\users\prete\Desktop\booksrc$ gcc -g firstprog.c but it doesn't work

please help me thank you!

  • Do you mean something like adding the option `-S` to the command line and using a text editor to look at firstprog.s? – Michael Petch Sep 23 '18 at 21:40
  • 1
    "Doesn't work" is not a good problem description. What happens? What's the exact error you get? Do you even have `gcc` installed? Can you run it? Do you just have problem with getting the assembly listing? – Jester Sep 23 '18 at 21:57
  • @PeterCordes : Jester may be onto something I didn't catch at first. The OPis getting an error which could suggest this is a GCC installation issue or GCC not being on the path. – Michael Petch Sep 23 '18 at 22:42
  • @MichaelPetch: I wondered that, too, but no point in anyone wasting their time answering the current question until / unless the OP edits the question to clarify, e.g. with an actual error message to make a [mcve]. As asked, it's either a non-MCVE or a duplicate, so for now at least it should be closed. – Peter Cordes Sep 23 '18 at 22:56

1 Answers1

2

I am not sure about windows, but as far as I know, the assembly output is gained by the -S option for gcc.

Try gcc -S firstprog.c

The output will be firstprog.s in AT&T syntax. If you want it in the intel syntax (might be rather helpful if you use NASM/MASM/YASM and such for assembling), try:

gcc -S -masm=intel firstprog.c
fuz
  • 88,405
  • 25
  • 200
  • 352