代码
struct sockaddr_in ser;
...
#line 68
fprintf(stderr, "Can't find host %s\n", inet_ntoa(ser.sin_addr));编译(gcc ...)警告
68: warning: format '%s' expects type 'char *', but argument 3 has type 'int'但是"inet_ntoa()“应该返回"char *",对吧?
发布于 2012-12-21 08:50:46
默认情况下,未使用活动原型的函数返回int。此行为在ISO C标准中指定(至少在C90中)。
您需要在声明该函数的位置包含头文件,以便编译器具有正确的原型。
https://stackoverflow.com/questions/13982704
复制相似问题