Can I treat a specific warning as an error?

/we4715 works for me.

In Visual Studio 2013 anyway, it is in the UI under Project Settings -> Configuration Properties -> C/C++ -> *Advanced *-> Treat Specific Warnings as Errors. Add "4715".

Docs: http://msdn.microsoft.com/en-us/library/thxezb7y.aspx

(Please note that this page lists the wrong UI property for VS2013.)


This should do the trick: #pragma warning (error: 4715).
Or the /we4715 command line option (see /w, /W0, /W1, /W2, /W3, /W4, /w1, /w2, /w3, /w4, /Wall, /wd, /we, /wo, /Wv, /WX (Warning Level) (courtesy of Tom Sigerdas)).