在Linux下安装libnet两种方式:
1:Ubuntu
apt-get install libnet-dev
2:下载libnet地址: https://github.com/sam-github/libnet https://sourceforge.net/projects/libnet-dev/
下载之后解压,安装
tar -zxvf libnet-1.2-rc3.tar.gz
cd libnet-1.2-rc3
./configure
make
make install
但是在编译C程序是出现未定义错误:
root@ubuntu:/home/sean/Desktop/MakeP# gcc udp.c
/tmp/ccEWD6MI.o: In function `main':
udp.c:(.text+0x15b): undefined reference to `libnet_init'
udp.c:(.text+0x19e): undefined reference to `libnet_name2addr4'
udp.c:(.text+0x1c5): undefined reference to `libnet_name2addr4'
udp.c:(.text+0x20b): undefined reference to `libnet_build_udp'
udp.c:(.text+0x269): undefined