相关疑难解决方法(0)

如何在我不想编辑的第三方代码中禁用gcc中未使用的变量警告?

我想知道你传递给gcc编译器的什么开关来关闭未使用的变量警告?我在Windows上获得了错误,我不想触摸增强代码:

C:\boost_1_52_0/boost/system/error_code.hpp: At global scope:
C:\boost_1_52_0/boost/system/error_code.hpp:214:36: error: 'boost::system::posix_category' defined but not used [-Werror=unused-variable]
C:\boost_1_52_0/boost/system/error_code.hpp:215:36: error: 'boost::system::errno_ecat' defined but not used [-Werror=unused-variable]
C:\boost_1_52_0/boost/system/error_code.hpp:216:36: error: 'boost::system::native_ecat' defined but not used [-Werror=unused-variable]
Run Code Online (Sandbox Code Playgroud)

我尝试使用两者-Wunused-value,-Wno-unused-value但都没有压制上面的消息.

什么是正确的命令,这是我的编译行:

g++  -g -fno-inline -Wall -Werror -Wextra -Wfloat-equal -Wshadow
-Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wno-conversion 
-Wdisabled-optimization -Wredundant-decls -Wunused-value -Wno-deprecated 
-IC:\\boost_1_52_0 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 
-c -o op.o op.cpp
Run Code Online (Sandbox Code Playgroud)

也许这-Wall超越了我的目标?

c++ gcc compiler-flags compiler-warnings

83
推荐指数
6
解决办法
15万
查看次数

标签 统计

c++ ×1

compiler-flags ×1

compiler-warnings ×1

gcc ×1