When running cl.exe
, you can specify the warning level.
cl /W3
cl /W4 # warn even more
cl /Wall # all warnings on
However, the highest level, /Wall
, seems impractical because it triggers warnings in Windows header files, such as in windef.h
(Windows SDK for VS2010). The two most frequently occurring ones seem to be C4668 and C4820. So you can switch them off:
cl /Wall /wd4668 /wd4820
Still leaves you with C4255:
C:\SDKs\Windows\v7.0A\include\windef.h(230) : warning C4255: 'FARPROC'
C:\SDKs\Windows\v7.0A\include\windef.h(231) : warning C4255: 'NEARPROC'
C:\SDKs\Windows\v7.0A\include\windef.h(232) : warning C4255: 'PROC'
So you add that as well:
cl /Wall /wd4668 /wd4820 /wd4255
But others might crop up. And I might want to keep those warnings for my own code, just not have the output cluttered by warnings which did not originate in my code.
Is there a way to make the compiler apply different settings to standard headers than to my own code?
Update
Hmm, there's a similar question, and the answer is to go with /W4
instead of /Wall
. Maybe it's not possible with MSVC to specify different settings for different files.