首页 > 代码库 > error: pointer targets in passing argument 3 of 'accept' differ in signedness [-Werror=pointer-sign
error: pointer targets in passing argument 3 of 'accept' differ in signedness [-Werror=pointer-sign
代码:
if((server_fd = accept(sockfd,(struct sockaddr *)&server_addr, &sin_size)) == -1) { fprintf(stderr, "Accept error:%s\n\a", strerror(errno)); exit(1); }
如果出现下面的情况有两种解决方法:
rfid.c:109:47: error: pointer targets in passing argument 3 of ‘accept‘ differ in signedness [-Werror=pointer-sign] if((server_fd = accept(sockfd,(struct sockaddr *)&server_addr, &sin_size)) == -1) ^ In file included from rfid.c:22:0: /opt/buildroot-2012.08/arm920t/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/sys/socket.h:214:12: note: expected ‘socklen_t * __restrict__‘ but argument is of type ‘int *‘ extern int accept (int __fd, __SOCKADDR_ARG __addr, ^ cc1: all warnings being treated as errors make: *** [rfid] 错误 1
第一种:
在makefile文件中注释
#CFLAGS+=-Werror -Wall
第二种:
将代码中sin_size的int类型改为socklen_t
socklen_t sin_size =0; //int sin_size = 0;
OK !
参考:
http://www.ajaxstu.com/Linuxbiancheng/294209.html
http://blog.csdn.net/blueliuyun/article/details/7638532
error: pointer targets in passing argument 3 of 'accept' differ in signedness [-Werror=pointer-sign
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。