gcc编译器 CFLAGS 标志参数说明 CFLAGS = -g -O2 -Wall -Werror -Wno-unused 编译出现警告性错误unused-but-set-variable,变量定义但没有使用,解决方法: 增加CFLAGS 或CPPFLAGS参数如下: CPPFLAGS=" -Werror -Wno-unused-but-set-variable" || exit 1 Gcc总体选项列表 ·“-I dir” 正如上表中所述,“-...
◆unused-label:遇到声明过但不使用的标号的警告。 ◆unused-parameter:从未用过的函数参数的警告。 ◆unused-variable:在本地声明但从未用过的变量的警告。 ◆unused-value:仅计算但从未用过的值得警告。 ◆Format:检查对printf和scanf等函数的调用,确认各个参数类型和格式串中的一致。 ◆implicit-int:警告没有规定...
如$ gcc -Wall test.c -o test 以“-Wno-”开头关闭特定的警告; 例如: -Wno-return-type (取消返回值告警) -Wno-sign-compare(取消有符号和无符号对比告警) 如:$ gcc -Wall -Wno-unused test.c -o test gcc官网有专门解释所有告警选项的说明文档。文档中介绍的配置项有几十甚至上百个,按照类型可以把...
-Wno-unused-variable:不显示未使用的变量告警-Wno-unused-parameter:不显示未使用的参数告警-Wno-unused-function:不显示未使用的函数告警-Wno-unused-but-set-variable:不显示已赋值但未使用的变量告警-Wno-unused-private-field:不显示未使用的类私有成员告警-Wno-unused-label:不显示未使用的跳转标记告警-Wno-depr...
-Wunused-but-set-variable 对声明且被赋值但未被使用的变量发出警告 -Warray-bounds=1 数组越界检查,需启用选项-ftree-vrp 完整的列表参见链接Warning-Options。 当需要排除某些类型的警告时,记得使用-Wno-xxx, 比如使用-Wall -Wno-unused-variable可以从-Wall中排除-Wunused-variable。 2 -Wextra 单单只有-Wall...
-Wno-sign-compare(取消有符号和无符号对比告警) 如:$ gcc -Wall -Wno-unused test.c -o test 批量开启告警(即-Wall和-Wextra 批量开启的告警) 某些选项(如-Wall和-Wextra )会打开其他选项,例如-Wunused ,这可能会启用其他选项,例如-Wunused-value 。
MMseqs2 tests their project using Ubuntu 16.04 and -Werror=unused-but-set-variable so they see the following build failures: [ 30%] Building CXX object src/CMakeFiles/mmseqs-framework.dir/alignment/Alignment.cpp.o In file included from /...
To fix, first see if the unused variable or parameter can be removed without changing the result or logic of the surrounding code. If not, annotate it with __attribute__((__unused__)). As a workaround, add -Wno-error=unused-but-set-variable or ...
一个项目需要在gcc4.1.2(公司服务器)和gcc4.7.3+(桌面linux系统)上编译,并且存在一些问题:gcc4.1.2没有Wno-unused-result和Wno-unused-but-set-variable我尝试用Wno-unused替换后两者,但是仍然产生了一个内置函数错误的忽略返回值。在gcc4.1.2中也没有Wno-narrowing,还有什么我可以使用的吗?
F-Stack is an user space network development kit with high performance based on DPDK, FreeBSD TCP/IP stack and coroutine API. - Fix f_stack -Werror=unused-but-set-variable errors with gcc compilers · aminenko-afs/f-stack@12a47d2