0
我正在學習gcc選項DDEBUG
。 下面是我的測試簡單的代碼:DDEBUG = 0不起作用
#include <stdio.h>
#include <stdlib.h>
#ifdef DEBUG
#define debug(msg) printf("Debug: %s\n", msg)
#else
#define debug(msg)
#endif
int main(int argc, char const *argv[])
{
debug("Debug flag was defined\n");
printf("hello world\n");
return 0;
}
然後,我用gcc -DDEBUG=0 debug.c
編譯,我希望「被定義調試標誌」將不被打印出來,但是它的作用。我可否知道爲什麼-DDEBUG=0
不起作用?
也許你混淆了'和'#if'#ifdef' –