简体   繁体   English

停止将警告视为错误

[英]Stop make from treating warnings as errors

I'm trying to make the little proxy server tcproxy : 我正在尝试make小代理服务器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

Compilation is failing because all warnings are being treated as errors 编译失败,因为all warnings are being treated as errors

It hasn't been updated in two years and it appears the warning is just from something being deprecated, but I'm hoping it should work nonetheless. 它已经有两年没有更新了,看来警告只是来自不赞成使用的东西,但是我希望它仍然可以工作。

I've Googled how to stop all warnings being treated as errors; 我已经搜索了如何停止将所有警告视为错误的警告; someone suggests using -Wno-error but that made no difference in my case. 有人建议使用-Wno-error但这对我的情况没有影响。

How can I force the compilation here? 如何在此处强制编译?

Note 注意

The Makefile simply contains: Makefile仅包含:

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

default: all

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

In src/Makefile there is a line defining : src/Makefile有一行定义:

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

Remove the -Werror and the warning you're getting should get ignored. 删除-Werror ,将忽略您收到的警告。

These are compiler options, not make options, to be clear. 这些是编译器选项,不是make选项。

You need to find the options that you use when make invokes your compiler. 您需要找到在make调用编译器时使用的选项。 Look in your makefile for the option -Werror , and remove it from whatever variable it's contained in (probably CFLAGS or some variation). 在makefile中查找选项-Werror ,然后将其从包含的任何变量中删除(可能是CFLAGS或某些变体)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Hive JDBC连接没有错误或警告 - No errors or warnings from Hive JDBC connection 调试时没有错误或警告 - debug with no errors or warnings C函数中的错误和警告 - errors and warnings in a function in C 编译器类型转换警告和错误 - Compiler typecasting warnings and errors 为什么 GCC 只有在使用结构名称而不是 typedef 时才会抛出错误和不必要的警告? - Why is GCC make throwing errors and uneccesary warnings only when using the struct name instead of typedef? 建立Wireshark时的错误和警告 - Errors and Warnings while building Wireshark 如何解决这些错误和警告? 还有一些来自这个程序的问题 - How can I solve these errors and warnings? Also a few questions from this program MSVC 在.c 文件中将任何类型的指针隐式转换为任何类型,而不给出错误或警告。 为什么? - MSVC casts pointers from any type to any type implicitly in .c files, not giving errors or warnings. Why? 除了 -Wall 和 -Wextra 之外,还有哪些工具可以用来发现尽可能多的错误或警告? - Apart from -Wall and -Wextra what other tools are available to spot as many errors or warnings as possible? 如何让fgets停止从键盘上读取 - How to make fgets stop reading from the keyboard
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM