0
我想有和沒有「-D DEBUG」 GCC標誌運行下面的代碼使用#ifdef來時:語法錯誤在C
#include <stdio.h>
#ifdef DEBUG
printf("Defined");
#else
printf("Not defined");
#endif
int main()
{
}
我得到的錯誤是「debugtest.c:6 :9:錯誤:預期的聲明說明符或「...」字符串常量前」
你不能有FUNC之外聲明蒸發散。 – 2014-11-22 04:24:45
運行預處理器後,如果您想查看代碼的外觀,請運行'gcc -E debugtest.c'。這會從'#include'打印一堆東西到屏幕上,然後你會看到'main'前面有一個孤獨的'printf'。 –
yellowantphil
2014-11-22 04:35:21