Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 使用/usr/include/net/if.h时发生编译错误_Macos_Compilation_Network Programming_Libpcap_Network Security - Fatal编程技术网

Macos 使用/usr/include/net/if.h时发生编译错误

Macos 使用/usr/include/net/if.h时发生编译错误,macos,compilation,network-programming,libpcap,network-security,Macos,Compilation,Network Programming,Libpcap,Network Security,我正试图为我的MacLion上的网络嗅探器编译现有的源代码。我安装了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 typ

我正试图为我的MacLion上的网络嗅探器编译现有的源代码。我安装了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$ 

我在谷歌上搜索了很多寻求帮助的信息,但都是徒劳的。有人能帮我一下吗?

看起来这是文件的顺序。看看这个,这是我在谷歌上找到的。

在我包括了if.h之后就开始工作了!非常感谢!