I'm using MSVC with a CMaked project. As a result, I've enabled many of the flags on MSVC which were enabled for gcc and clang. However, the /Wall warning level is giving me some pain; it warns me about all kinds of things in included headers, like stdio.h and boost headers. Is there a way to stop MSVC from warning me about things in headers? I like my warning levels, but I only want them enabled for me.
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Suppress “Circular dependency detected” suppress w
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
/Wall
is very pedantic./W4
is probably all you really need. To answer your question, you can disable specific warnings around your headers with:Or change the warning level with:
See the MSDN documentation: http://msdn.microsoft.com/en-us/library/2c8f766e.aspx
You can disable specific warnings using the
/wdXXXX
flag whereXXXX
is the number of the warnings you wish to ignore. No need to modify the code.Mark Tolonen has already point out
/W4
.If that still produces warnings, e.g. you're using an older MSVC version like 7.1, or you're using some 3rd party library that still produces warnings about perfectly good code, and you're aiming for clean compiles, then see my msvc silly-warning suppression header.
It's been through a few rounds of community review, in the comp.lang.c++ Usenet group, but it may/will need updating as Microsoft adds even more silly-warnings in new compiler versions… ;-)