How to apply a C preprocessor only to certain (#if/#endif) directives?

后端 未结 4 1969
攒了一身酷
攒了一身酷 2021-01-16 04:27

I was wondering if it is possible, and if yes how, can I run a C preprocessor, like cpp, on a C++ source file and only process the conditional directives #

4条回答
  •  情歌与酒
    2021-01-16 05:00

    The linux unifdef command does what you want:

    http://linux.die.net/man/1/unifdef

    Even if you're not on linux, there is source available on the web.

    BTW, this is a duplicate of another question: Way to omit undefined preprocessor branches by default with unifdef?

提交回复
热议问题