variable 'nbufs' set but not used [-Werror,-Wunused-but-set-variable]
zhangxiaolongZ opened this issue · comments
When you meet a bug, please open the issue including a title prefixed by '[bug]' and describe it as follows:
(当你碰到一个 bug,请在提出问题时以 '[bug]' 为前缀写明标题,并且像下面的内容一样描述它):
Expected behavior (期望行为)
Actual behavior (实际行为)
OS and Nginx version (操作系统和 Nginx 版本号)
Configuration file (配置文件)
Steps to reproduce the behavior (复现问题步骤)
Error log if any (错误日志)
I have no Mac at hand.
Add the following code after line 656 to test if it works:
(void) nbufs;
我也是**人,找到方法了 在objs的Makefile里 删掉-Werror
我也是**人,找到方法了 在objs的Makefile里 删掉-Werror
不建议这么做,可能有问题的地方不只这一处。
Mac 的编译器检查得更严格些,Linux (gcc-10.2.1) 和 Windows (Visual Studio 2022) 编译都没问题。根本原因是 configure
的时候如果没有添加 --with-debug
选项,ngx_log_debugX
是空的,所以出现 variable 'xxx' set but not used
的错误。
源代码其他文件里有处理方法,就是我上面写的,可以查看 ngx_rtmp_limit_module.c 的第 142 行,ngx_rtmp_mp4_module.c 的第 887 行。在 Linux 和 Windows 上都编译通过,但是我没有 Mac,无法验证。你可以试试,盼复。