我在试着编选
下面是通过make发出的命令:
gcc -Wall -Werror -ggdb -g -O2 -lpcap -o ethping ethping.o ieee8021ag.o dot1ag_eth.o
我现在收到以下错误消息:
/dot1ag-utils-master/src/ethping.c:65: undefined reference to `pcap_breakloop'
指示它找不到pcap.h
。
所以我输入:
root:src# whereis pcap.h
pcap: /usr/include/pcap.h /usr/include/pcap /usr/share/man/man3/pcap.3pcap.gz
root:src#
root:src# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/include
/usr/include
肯定在我的道路上。
唯一可能造成问题的是,/usr/include/pcap.h
是一个执行和包含pcap/pcap.h
的存根文件。
/*
* For backwards compatibility.
*
* Note to OS vendors: do NOT get rid of this file! Many applications
* expect to be able to include <pcap.h>, and at least some of them
* go through contortions in their configure scripts to try to detect
* OSes that have "helpfully" moved pcap.h to <pcap/pcap.h> without
* leaving behind a <pcap.h> file.
*/
#include <pcap/pcap.h>
因此,在/usr/include/pcap/pcap.h
中是包含这些定义的实际文件内容。
发布于 2015-02-05 15:16:17
您不仅必须安装头文件,还必须安装库。这些包以-dev
结尾,因此在本例中:
sudo apt-get install libpcap-dev
顺便说一下,这是一个元包,它将安装libpcap0.8-dev
包。
https://askubuntu.com/questions/582042
复制相似问题