这是我所做的..。#tar -xzvf libnet-0.10.11.tar.gz #cd libnet
然后,我将linux.mak文件复制到父目录中的port.mak文件。然后,正如文档所说,我在当前目录中使用了make ...
naman@naman-laptop:~/Desktop/Software/libnet$ make
make -C lib/ lib
make[1]: Entering directory `/home/naman/Desktop/Software/libnet/lib'
gcc -O2 -Wall -Werror -Wno-unused -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g -I../include -Iinclude -DTARGET_LINUX -c -o core/config.o core/config.c
cc1: warnings being treated as errors
core/config.c: In function ‘__libnet_internal__seek_section’:
core/config.c:87: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
core/config.c: In function ‘__libnet_internal__get_setting’:
core/config.c:111: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
make[1]: *** [core/config.o] Error 1
make[1]: Leaving directory `/home/naman/Desktop/Software/libnet/lib'
make: *** [lib] Error 2有没有人可以给我详细解释一下这个错误,以及如何纠正它?任何帮助都将不胜感激。
发布于 2013-11-27 03:54:50
https://github.com/sam-github/libnet,那是一个古老的libnet版本,现代的版本用的是autoconf,你需要用这么旧的版本吗?
我建议从您正在使用的makefile中删除-Wall和-Werror。
发布于 2011-02-05 14:15:18
看起来您正在尝试在较新的系统上编译一个较旧的库,并且自从编写此库以来,已向gcc添加了新的警告。
由于生成文件将警告视为错误(因为它输出了cc1: warnings being treated as errors,所以可以看出),警告warn_unused_result错误会导致编译失败。
您可以选择以下任一选项:
https://stackoverflow.com/questions/4813007
复制相似问题