How to suppress GCC warnings from library headers?

AdSR picture AdSR · Dec 8, 2009 · Viewed 47.2k times · Source

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.

Answer

Phi picture Phi · Dec 14, 2009

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.