为什么C4996上的Visual Studio 2013错误? [英] Why does Visual Studio 2013 error on C4996?

查看:131
本文介绍了为什么C4996上的Visual Studio 2013错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以前的Visual Studio版本中,使用_sleep或strncpy等函数只输出一个警告。在最新版本中,突然发生错误:

In previous versions of Visual Studio using functions like _sleep or strncpy just outputs a warning. In the latest version, it's suddenly an error:

我知道我可以通过添加 #pragma warning(disable:4996)的代码,但它是非常恼人的VS试图强迫我使用其他功能。是否有任何方法禁用此行为?

I know I can disable it by adding #pragma warning(disable: 4996) in the beginning of the code, but it's extremely annoying that VS is trying to force me to use other functions. Is there any way to disable this behavior?

在您提出问题之前,警告警告作为错误被禁用,即使我关闭所有警告也会出错! p>

Before you ask, "Treat Warnings As Errors" is disabled, and it errors even if I turn off all warnings!

推荐答案

显然,新项目现在默认启用SDK检查,将这些警告视为错误。要禁用它,请转到项目属性 - >配置属性 - > C / C ++ - >常规 - > SDL检查 - >否。

Apparently new projects enable "SDK check" by default now, which treats these warnings as errors. To disable it, go to project properties -> Configuration Properties -> C/C++ -> General -> SDL checks -> No.

这篇关于为什么C4996上的Visual Studio 2013错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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