【发布时间】:2011-10-26 06:23:25
【问题描述】:
我正在尝试为我的 Mac Lion 上的网络嗅探器编译现有源代码。我安装了 libpcap。源码中包含了一个头文件/usr/include/net/if.h,编译报错如下图。
Floyd:~ Shastry$ gcc -o arplisten arplisten.c -lpcap
In file included from arplisten.c:4:
/usr/include/net/if.h:265: error: field ‘ifru_addr’ has incomplete type
/usr/include/net/if.h:266: error: field ‘ifru_dstaddr’ has incomplete type
/usr/include/net/if.h:267: error: field ‘ifru_broadaddr’ has incomplete type
/usr/include/net/if.h:308: error: field ‘ifra_addr’ has incomplete type
/usr/include/net/if.h:309: error: field ‘ifra_broadaddr’ has incomplete type
/usr/include/net/if.h:310: error: field ‘ifra_mask’ has incomplete type
/usr/include/net/if.h:393: error: field ‘addr’ has incomplete type
/usr/include/net/if.h:394: error: field ‘dstaddr’ has incomplete type
arplisten.c:6:24: error: netinet/if.h: No such file or directory
arplisten.c: In function ‘main’:
arplisten.c:139: warning: incompatible implicit declaration of built-in function ‘strlen’
Floyd:~ Shastry$
我做了很多谷歌搜索以寻求帮助,但徒劳无功。有人可以帮我解决这个问题吗?
【问题讨论】:
标签: macos compilation network-programming libpcap network-security