《Unix网络编程》第三版 文件编译错误 inet_ntop.c:56:1: error: conflicting types for 'inet_ntop'

 

error_code:

inet_ntop.c:56:1: error: conflicting types for 'inet_ntop' inet_ntop(af, src, dst, size) ^ /usr/include/arpa/inet.h:77:13: note: previous declaration is here const char inet_ntop(int, const void , char , socklen_t); ^ 1 error generated. make: ** [inet_ntop.o] Error 1

由于  <arpa/inet.h> 同样也包含了 inet_ntop,造成声明重复。

解决:

进入 libfree 文件夹,找到 inet_ntop.c 文件,将#include <arpa/inet.h> 注释掉,随后编译即可。

 

error: conflicting types for "xxxxx" 此类错误代码原因

  1. 函数声明在函数实现之后
  2. 函数实现与声明参数不符合
  3. 函数重复声明,通常由于引用其他头文件导致。
posted @ 2020-10-11 08:24  ryan_d  阅读(447)  评论(0)    收藏  举报