Every C/C++ programmer knows that before a program is compiled, the preprocessor parses directives like #include and #define and macros and inserts them into the code, where they are used. But do you know how to see the preprocessor output? Did you know that’s even possible?
gcc -E file.c
or
g++ -E file.cpp
will do this for you. The -E switch forces the compiler to stop after the preprocessing phase, spitting all it’s got at the moment to standard output.
Note: Surely you must have some #include directives. The included files get preprocessed, too, so you might get lots of output.

Hi!,
Note: Surely you must have some #include directives. The included files get preprocessed, too, so you might get lots of output
I think what you mean to say is: “WARNING: You may get hideous amounts of output!!!”
I got 34,768 lines of post-preprocessor code from my 50 line program.
Thanks though, this tip really does help debugging the above mentioned 50 lines I’m currently having trouble with.
great page!
note that if you are trying to hack a build script like a Makefile to stick a ‘-E’ in , you also have to notice the ‘-o’ option – — your preprocessor output will wind up in wherever -o points to instead on stdout.