Can gcc output C code after preprocessing?

LGTrader picture LGTrader · Feb 4, 2011 · Viewed 114.2k times · Source

I'm using an open source library which seems to have lots of preprocessing directives to support many languages other than C. So that I can study what the library is doing I'd like to see the C code that I'm compiling after preprocessing, more like what I'd write.

Can gcc (or any other tool commonly available in Linux) read this library but output C code that has the preprocessing converted to whatever and is also readable by a human?

Answer

mipadi picture mipadi · Feb 4, 2011

Yes. Pass gcc the -E option. This will output preprocessed source code.