views:

142

answers:

2

Hi

i want to know how could we look at the c file after it has been expanded by the preprocessor before compilation with all the macro values put in the code inside the function where ever they are used. in there a way to do it?

+13  A: 

You can ask gcc to do it for you gcc -E yourfile.cpp

That will expand macros and include files, all the preproccessing.

Arkaitz Jimenez
+7  A: 

Just run it through cpp:

cpp file.c
Kinopiko
add `-nostdinc` to the cpp invocation to prevent standard headers from being expanded.
pmg
is there a similar option is gcc also ?
Vijay Sarathi
`-nostdinc` also works for gcc with the `-E` argument :)
pmg