如何在MSVC ++中启用6000系列警告(代码分析警告)? [英] How do I enable the 6000 series warnings (code analysis warnings) in MSVC++?

查看:54
本文介绍了如何在MSVC ++中启用6000系列警告(代码分析警告)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使警告级别4和所有警告也不能使 6000系列警告出现。

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

推荐答案

实际上启用这些代码分析警告具有其自己的对话框。

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.

此代码应显示错误6246:

This code should then show error 6246:

#include <stdio.h>

int main()
{
  int x ;

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

}




警告C6246: x的本地声明在外部范围内隐藏了相同名称的声明。
warning C6246: Local declaration of 'x' hides declaration of the same name in outer scope.

此设置似乎完全独立于属性对话框中的配置属性/ C / C ++ /常规/警告级别设置。

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

这篇关于如何在MSVC ++中启用6000系列警告(代码分析警告)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆