1.使用gcc編譯C文件,C文件在for循環語句中出現變量定義
? ? ?
? ? ? 編譯器提示錯誤:“for”loop initial declarations are only allowed in C99 mode.?
? ? ? ? ? ? ? ? ? ? note:use option -std=c99or-std=gnu99 to compile;
? ? ? 原因:gcc的標準是基于c89的,c89不能在循環中定義變量,而c99標準可以這樣定義
? ? ? 解決辦法:在循環外先定義變量i;
2.編譯文件時出現warning:incompatible implicit declaration of built -in function
? ? 錯誤原因:缺乏頭文件,只需要把對應的頭文件加入就行了