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?
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 .
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.
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 .
Use -isystem
Example:
gcc -I./src/ -isystem /usr/include/boost/ -c file.c -o obj/file.o
With -isystem NO warning about boost :D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With