BitsBitsBits
BitsBitsBits

Reputation: 604

GCC -E preprocessor output

I am trying to preprocess a .h file and produce a new .h file with all of the # preproc directives resolved. I used gcc -E file.c command and I always get this output:

# 1 "file.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "file.c"

Which command should I use to produce a new preprocessed .h file?

Upvotes: 1

Views: 562

Answers (1)

Jens
Jens

Reputation: 72649

From https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html

-P
Inhibit generation of linemarkers in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code, and will be sent to a program which might be confused by the linemarkers.

Simply use

gcc -E -P file.c

Upvotes: 1

Related Questions