Surpress compiler warnings of third party libraries

I like my compiler to be very verbose and pedantic. For me, -Wall -Wextra -pedantic -Weffc++ is a must. And I don’t want to see any warnings before releasing my software.

Well, but your compiler might still complain about headers of third party libraries which you do not want to touch. How to remove those annoying warnings?

Here’s the simplest solution. Just add

#pragma GCC system_header

to the affected header file and you will not be disturbed by those warnings any more.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.