Search code examples
visual-studiocompiler-warningspragma

Is there anything similar to "#pragma GCC system_header" for MSVS?


We try to enable as many warnings as possible in our project, and warnings are promoted to errors. We disable useless warnings or ones that are too fuzzy.

Recently I added a third party single-header library in our project. It has a few warnings, which we don't want to disable or fix in this file.

I found that GCC has #pragma GCC system_header, which treats current file as a system file (by using -isystem instead of -I), and this disables all warnings from this file.

The questions is - is there anything similar to this pragma in Visual Studio?


Solution

  • Solution I used to disable warnings from a third party header:

    #pragma warning(push, 0)
    #include <...>
    #pragma warning(pop)