1. 程式人生 > >gcc編譯出現“warning: implicit declaration of function ‘inet_aton’”

gcc編譯出現“warning: implicit declaration of function ‘inet_aton’”

在linux下寫了一個簡單的網路程式,用到函式inet_aton。使用gcc編譯,編譯的時候加上了-std=c99,編譯可以通過,但是報錯“warning: implicit declaration of function ‘inet_aton’”。去掉-std=c99,編譯正常通過,沒有報錯。google了一下,發現gcc提供的一些c擴充套件與標準c有衝突。在gcc中使用"-std=c99"時,gcc會關閉產生衝突的擴充套件。如果要使用gcc針對c99的擴充套件,設定“-std=gnu99”,編譯就不會報錯了。

http://stackoverflow.com/questions/1783792/why-does-gcc-report-implicit-declaration-of-function-round