cpp:延迟#include直到第二次通过 [英] cpp: delay #include's until second pass
本文介绍了cpp:延迟#include直到第二次通过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在编译之前通过C预处理器运行我的源文件两次,我想延迟#include指令直到第二次传递。
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>
我只需要一个构造,在预处理时,将给出 #include mylib
。
I just need a construct, that when preprocessed, will give #include mylib
.
推荐答案
您可以定义一个宏,例如
You could define a macro, like
#define INCLUDE #include
然后当你包含东西时,请改用宏。
and then when you include stuff, use the macro instead.
INCLUDE <zlib.h>
在GCC的预处理器中,至少,这给了我 #include< zlib .h>
。
In GCC's preprocessor, at least, that gives me #include <zlib.h>
.
这篇关于cpp:延迟#include直到第二次通过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文