macro definition containing #include directive

前端 未结 9 962
抹茶落季
抹茶落季 2020-12-08 06:55

Is there a way to define a macro that contains a #include directive in its body?

If I just put the \"#include\", it gives the error

9条回答
  •  孤城傲影
    2020-12-08 07:43

    Contagious is right -- if you're doing:

    myFile.c:

    #include "standardAppDefs.h"
    #myStandardIncludeMacro
    

    standardAppDefs.h:

    #define myStandardIncludeMacro #include 
    

    Why not just say:

    myFile.c:

    #include "standardAppDefs.h"
    

    standardAppDefs.h:

    #include 
    

    And forget the macros?

提交回复
热议问题