问题
I'm running my source file through the C preprocessor twice before compiling it, and I want to delay The #include directives until the second pass.
Intuitively, I tried this, but it doesn't work:
##include <zlib.h>
I just need a construct, that when preprocessed, will give #include mylib
.
回答1:
You could define a macro, like
#define INCLUDE #include
and then when you include stuff, use the macro instead.
INCLUDE <zlib.h>
In GCC's preprocessor, at least, that gives me #include <zlib.h>
.
来源:https://stackoverflow.com/questions/6379404/cpp-delay-includes-until-second-pass