编译源在我的C++文件,我有任何脚本来剔除在C++
#ifdef DEBUG
then blah
#else
blooh.
我想去掉不经过预处理,这样,如果DEBUG
没有定义被编译,所有的文字,那么表格中的所有声明:
#ifdef DBUG
/* some debug code */
#endif
被剥离出来。
编辑:下面是一个例子:
#include <iostream>
//#define DEBUG
int main(){
#ifdef DEBUG
cout << "In debug\n";
#endif
cout << "hello\n";
return 0;
}
和运行脚本后,输出应该是
#include <iostream>
//#define DEBUG
int main(){
cout << "hello\n";
return 0;
}
心不是预处理器做什么? – slartibartfast
不,我想OP不希望替换'#define'd符号,评估其他'#ifdef',插入'#include'等。 –