1.net.h:30:18: fatal error: pcap.h: No such file or directory
安装libpcap-devel包,执行yum install libpcap-devel
2.net.h:31:20: fatal error: libnet.h: No such file or directory
安装libnet-devel包,执行yum install libnet-devel
3.main.c:212:25: error: invalid application of ‘sizeof’ to incomplete type ‘struct udphdr’
len = pktlen - sizeof(struct udphdr);
在main.c中增加头文件netinet/udp.h
#include <netinet/udp.h>
OK,编译成功。