为什么C4996上的Visual Studio 2013错误? [英] Why does Visual Studio 2013 error on C4996?
问题描述
在以前的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屋!