如何从库头压缩GCC警告? [英] How to suppress GCC warnings from library headers?

查看:112
本文介绍了如何从库头压缩GCC警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用log4cxx,boost等库的项目,这些库的头文件会生成很多(重复)警告。有没有办法从库中包含警告(即#include )或包含某些路径?我想在项目代码上像往常一样使用-Wall和/或-Wextra,而相关信息不被遮盖。我现在在make输出上使用grep,但是我想要更好的东西。

c $ c> -isystem 而不是 -I 。这将使他们成为系统标题,GCC不会为他们报告警告。


I have a project that uses log4cxx, boost, etc. libraries whose headers generate lots of (repetitive) warnings. Is there a way to suppress warnings from library includes (i.e. #include <some-header.h>) or includes from certain paths? I'd like to use -Wall and/or -Wextra as usual on project code without relevant info being obscured. I currently use grep on make output but I'd like something better.

解决方案

You may try to include library headers using -isystem instead of -I. This will make them "system headers" and GCC won't report warnings for them.

这篇关于如何从库头压缩GCC警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆