简体   繁体   中英

GCC -E preprocessor output

I am trying to preprocess ah 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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM