編譯源在我的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'等。 –