简体   繁体   中英

Is there a way to enable gcc preprocessor output for a subset of the compilation?

I am trying to track down why a header isn't being included. Since my compilation covers many files, I would like to enable the preprocessor output to only the single file I'm interested in, or preferably just a few lines which include the #include. Is this possible? And if so, how do you enable this? I didn't see any pragmas which were related to this capability.

There are directives to disable preprocessor output for parts of a translation unit: Just surround those by

#if 0

#endif

But Bruce K's suggestion

Just grab it all and wade through it.

sounds better to me (that way you won't inadvertently exclude the real reason of your problem, which might be elsewhere than you think). I recommend options -dD -E .

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