How do I run the preprocessor on local headers only?

前端 未结 4 2102
陌清茗
陌清茗 2020-12-03 17:12

I want the preprocessor to read in the includes of local headers, but ignore the includes of system headers. To put it another way, how do I get the preprocessor to skip ov

4条回答
  •  一个人的身影
    2020-12-03 17:30

    With clang you can do e.g.:

     clang -Imyinclude -P -E -nostdinc -nobuiltininc main.cpp
    

    There does not seem to be a way to preserve the system #include lines it cannot find though.

    This doesn't work for gcc, as its preprocessor will stop when using -nostdinc and it can't find an #included header file.

提交回复
热议问题