warning: implicit declaration of function ‘inet_ntop’解决办法
来源:互联网 发布:薪酬数据分析 模板 编辑:程序博客网 时间:2024/05/26 22:06
问题:
在打印hostent的IP地址时,用到了inet_ntop(),在编译时显示这样的警告提示:
dingq@wd-u1110:~/hwsvn/2sw/1prj_linux/pdu/src/branches/pdu-isocket/isocket$ make clean;makerm -rf *.o tcpclient tcpservergcc -g3 -Wall -o0 -std=gnu99 -c nettrans.c -o nettrans.onettrans.c: In function ‘nettrans’:nettrans.c:59:5: warning: implicit declaration of function ‘inet_ntop’ [-Wimplicit-function-declaration]gcc -g3 -Wall -o0 -std=gnu99 -c tcpclient.c -o tcpclient.ogcc -g3 -Wall -o0 -std=gnu99 -c frm_package.c -o frm_package.ogcc -g3 -Wall -o0 -std=gnu99 -c sensor-att7053.c -o sensor-att7053.ogcc nettrans.o tcpclient.o frm_package.o sensor-att7053.o -o tcpclient
解决办法:
1. -sta=gnu99的选项是后来加上去的,不加的话不能在for循环中初始化变量,比如:
for(int i=0; i<10; i++)
2. 添加对头文件<arpa/inet.h>的包含,编译成功,没有警告;
dingq@wd-u1110:~/hwsvn/2sw/1prj_linux/pdu/src/branches/pdu-isocket/isocket$ make clean;makerm -rf *.o tcpclient tcpservergcc -g3 -Wall -o0 -std=gnu99 -c nettrans.c -o nettrans.ogcc -g3 -Wall -o0 -std=gnu99 -c tcpclient.c -o tcpclient.ogcc -g3 -Wall -o0 -std=gnu99 -c frm_package.c -o frm_package.ogcc -g3 -Wall -o0 -std=gnu99 -c sensor-att7053.c -o sensor-att7053.ogcc nettrans.o tcpclient.o frm_package.o sensor-att7053.o -o tcpclient
问题解决。
- warning: implicit declaration of function ‘inet_ntop’解决办法
- 关于 warning: implicit declaration of function ‘****’
- implicit declaration of function '...' 的warning
- warning: implicit declaration of function导致core
- implicit declaration of function XXXXXXX 的warning
- warning: implicit declaration of function 与c99
- 嵌入式 warning: implicit declaration of function 'xxx'
- warning:implicit declaration of function 'free'
- 解决warning:implicit declaration of function 'Xil_Out32' [-Wimplicit-function-declaration]
- implicit declaration of function 's3c2410_gpio_cfgpin"的解决办法
- implicit declaration of function
- implicit declaration of function
- implicit declaration of function
- warning incompatible implicit declaration of built-in function 'printf'
- gcc编译出现“warning: implicit declaration of function ‘inet_aton’”
- warning: incompatible implicit declaration of built-in function ***
- gcc warning: incompatible implicit declaration of built-in function
- warning:incompatible implicit declaration of built-in function
- 如何在ecmall中添加一个模板
- GestureDetector、SimpleOnGestureListener使用
- snmp mib2c 模板使用
- Redis几个认识误区
- ubuntu中用php按时间段导出netbeans6.9更改过的文件!
- warning: implicit declaration of function ‘inet_ntop’解决办法
- 自己创建mib2c.XXX.conf文件
- apache中mod_expires
- 【HTC Desire S/S510e(S-OFF)完美刷机攻略】超详细新手教程之刷Recovery及刷ROM
- 相约世纪末
- String,StringBuffer与StringBuilder的区别
- Visual C++ 中窗口子类化和超类化技术的应用
- Row_Number(),Rank和 Dense_Rank以及NTLINE
- 程序员面试 -- 数据库