Is there any way to prevent Visual Studio from printing out warnings from included libraries?
\Wall gives me loads of warnings from STL and Qt headers, although I only want to see those originating from my own code (i.e. the code which is part of the current Visual Studio project).
You can use pragma to set the warning levels for each file.
So before you include
#pragma warning( push )
#pragma warning( disable : 4705 )
#pragma warning( disable : 4706 )
#pragma warning( disable : 4707 )
// Some code
#include your files here
#pragma warning( pop )
More information here: http://msdn.microsoft.com/en-us/library/2c8f766e%28v=vs.80%29.aspx
That's the only portable way (if using -isystem with other compilers):
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: ...)
#endif
#include <Q...>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
Hopefully they will implement isystem one of these days:
https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/14717934-add-a-cl-exe-option-for-system-headers-like-gcc-s
You can use warning level 4, it will only include warnings for your code.