Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
938 views
in Technique[技术] by (71.8m points)

visual c++ - How do I enable the 6000 series warnings (code analysis warnings) in MSVC++?

Even warning level 4 and "all warnings" does not make the 6000 series warnings appear.

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

Actually enabling these "Code Analysis" warnings has it's own dialog.

In your project properties, you must check "Enable Code Analysis on Build" to make it work.

code analysis

This code should then show error 6246:

#include <stdio.h>

int main()
{
  int x ;

  {
    int x = 6 ;
    printf( "%d
", x ) ;
  }

}
warning C6246: Local declaration of 'x' hides declaration of the same name in outer scope.

This setting appears to be completely independent of the "Configuration Properties/C/C++/General/Warning Level" setting in the properties dialog.

setting doesnt matter


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...