libnet.h 没有那个文件或目录

libnet.h no such file or directory

因此,我正在尝试使用命令 "gcc -o file file.c" 编译我的 C 代码,但我得到 "error: libnet.h: No such file or directory" 我包含 libnet.h (#include ) 并且我还安装了 libnet。我是 运行 CentOS 7.

yum install libnet 只安装预编译库。

您需要先使用 yum install libnet-devel 安装头文件,然后才能在您自己的软件中使用它。