Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is there a compiler switch to enable a single warning in Visual Studio?

The reason I ask is I want to enable warning C4265 which is off by default. My searching has only turned up ways to turn warnings off.

Even Microsoft pages called How to: Enable or Disable Compiler Warnings still only mention disabling.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
254 views
Welcome To Ask or Share your Answers For Others

1 Answer

#pragma warning(default:4265)

It might seem like that would set the warning to it's default setting(which would be disabled), but that's not the case. It turns it on.

http://msdn.microsoft.com/en-us/library/2c8f766e%28VS.80%29.aspx

You can also do this:

#pragma warning(X:4265)
// where X is the warning level(1,2,3 or 4) that you want this warning to be generated at

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...