Linux服务器客户端编写过程中报错”implicit declaration of function ‘inet_pton’ “ 1. 问题 Linux服务器客户端编写过程中报错: 2. 问题分析 gcc的c扩展与c标准有冲突 2. 解决方案 添加头文件#include <arpa/inet.h>
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;make rm -rf *.o tcpclient ...
nettrans.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.o gcc-g3-Wall-o0-std=gnu99-c frm_package.c-o frm_package.o gcc-g3-Wall-o0-std=gnu99-c...
-g2 -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -Wall -fno-omit-frame-pointer -fno-strict-aliasing -Werror=implicit-function-declaration LDFLAGS: -Wl,-L$(top_srcdir)/lib,-L$(top_builddir)/lib -lpthread -fstack-protector-strong -rdynamic -L/usr/local/lib ...