【发布时间】:2014-08-19 21:42:32
【问题描述】:
我正在做一个项目,我在其中使用新的 c++11 标准。
因此,现在很少有来自库的包含头会生成警告 -Wliteral-suffix,我会禁止包含该警告。
我找到了一个使用编译指示的简单解决方案,但它对我不起作用
How to suppress GCC warnings from library headers?
这是我当前的代码:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wliteral-suffix"
#include <pylon/PylonBase.h>
#include <pylon/InstantCamera.h>
#include <pylon/TlFactory.h>
#pragma GCC diagnostic pop
该库生成的所有当前警告如下所示:
/opt/pylon3/genicam/library/CPP/include/Base/GCException.h:272:105: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
我正在使用gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
【问题讨论】:
-
使用
-fdiagnostics-show-option运行 GCC 以查看是否可以禁用该警告;可能只是 GCC 阻止您禁用它。 -
看起来像bug
标签: c++ c++11 g++ compiler-warnings suppress-warnings