c - 停止 make 将警告视为错误

标签 c linux compiler-errors makefile

我正在尝试制作 小代理服务器 tcproxy :

user@localhost:tcproxy $ make
cd src && make all
make[1]: Entering directory '/home/user/Downloads/tcproxy/src'
    CC anet.o
In file included from /usr/include/sys/types.h:25:0,
                 from anet.c:33:
/usr/include/features.h:148:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
cc1: all warnings being treated as errors
Makefile:26: recipe for target 'anet.o' failed
make[1]: *** [anet.o] Error 1
make[1]: Leaving directory '/home/user/Downloads/tcproxy/src'
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 2

编译失败,因为所有警告都被视为错误

它已经两年没有更新了,警告似乎只是来自一些被弃用的东西,但我希望它仍然可以工作。

我用谷歌搜索了如何阻止所有警告被视为错误;有人建议使用 -Wno-error 但这对我的情况没有影响。

我怎样才能在这里强制编译?

注意

Makefile 只包含:

#
# tcproxy - Makefile
#
# Author: dccmx <dccmx@dccmx.com>
#

default: all

.DEFAULT:
    cd src && $(MAKE) $@

最佳答案

src/Makefile 中有一行定义:

CFLAGS_GEN = -Wall -Werror -g $(CFLAGS)

删除 -Werror 并且您收到的警告应该被忽略。

关于c - 停止 make 将警告视为错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28884664/

相关文章:

C编程...链表指针迭代

C:如何从文件中读取可变数量的信息并将其存储在数组中

c++ - 如何检测 win32 上的数据卡连接和断开事件?

linux -/etc/fstab 和/etc/mtab 有什么区别

linux - 如何在 Linux Web 服务器上创建快捷方式文件夹?

java - 为什么我得到可以由jdk8、10、11、12构建的pom,但不能由jdk9构建?

c++ - C/C++ time_t(以微秒为单位)

linux - 由于字体更改为印地语,在 Linux 中登录时卡住,解决方案?

android - Error :Execution failed for task ':app:transformClassesWithJarMergingForDebug' 的解决方法是什么

objective-c - 内联函数 "undefined symbols"错误