在程序中调用
device = pcap_lookupdev(errbuf); //find the device devicep=pcap_open_live(device,SNAPLEN,PROMISC,READ_TIME_OUT,errbuf);
.obj/main.o(.text+0xf): In function `Init_pcap()':
/tmp/lgf/sniffer/cap_pkt.h:29: undefined reference to `pcap_lookupdev'
.obj/main.o(.text+0x3e):/tmp/lgf/sniffer/cap_pkt.h:31: undefined reference to `pcap_open_live'
collect2: ld returned 1 exit status
make: *** [sniffer] Error 1
我在头文件中写了
#include "/usr/include/pcap.h"
???