Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to eliminate external lib/third party warnings in GCC [duplicate]

In the software project I'm working on, we use certain 3rd party libraries which, sadly, produce annoying gcc warnings. We are striving to clean all code of warnings, and want to enable the treat-warnings-as-errors (-Werror) flag in GCC. Is there a way to make these 3rd party generated warnings, which we cannot fix, to disappear?

like image 626
Michael Avatar asked Jul 22 '10 11:07

Michael


People also ask

How do I supress a warning in GCC?

To suppress this warning use the unused attribute (see Variable Attributes). This warning is also enabled by -Wunused , which is enabled by -Wall . Warn whenever a static function is declared but not defined or a non-inline static function is unused. This warning is enabled by -Wall .

How do you ignore a warning when compiling?

Every body tells use -Wall switch with gcc, but you want to disable it. It is not advised, Use debugger to find it. I would not remove -Wall , but after -Wall you want to add some -Wno-* options to disable some of the nuisance and false-positive warnings.

How do I ignore GCC?

Disabling the warning GCC: #pragma GCC diagnostic ignored "-W…" where the ellipsis is the name of the warning; e.g., #pragma GCC diagnostic ignored "-Wdeprecated-declarations .


1 Answers

Use -isystem Example:

gcc -I./src/ -isystem /usr/include/boost/ -c file.c -o obj/file.o 

With -isystem NO warning about boost :D

like image 95
ImmortalPC Avatar answered Oct 05 '22 10:10

ImmortalPC