默认情况下,在 Visual Studio 中从项目中删除安全

Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio(默认情况下,在 Visual Studio 中从项目中删除安全警告 (_CRT_SECURE_NO_WARNINGS))
本文介绍了默认情况下,在 Visual Studio 中从项目中删除安全警告 (_CRT_SECURE_NO_WARNINGS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在默认情况下为所有项目设置删除使用 scanf() 等函数时出现的预编译器安全警告.我发现您可以通过在项目选项中添加一行或在代码开头添加 #define _CRT_SECURE_NO_WARNINGS 来实现.

Is there a way to set by default for all projects removing the precompiler secure warnings that come up when using functions like scanf(). I found that you can do it by adding a line in the project option or a #define _CRT_SECURE_NO_WARNINGS in the beginning of the code.

我发现自己不断地为解决编程竞赛而创建新项目,添加内容真的很烦人(并且需要花费宝贵的时间):

I find myself repeatedly creating new projects for solving programming contests and it is really annoying (and takes valuable time) to add:

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

在代码的开头,或者每次启动新项目时在预编译器选项中设置.

In the beginning of the code, or to set it in the precompiler options every time I start a new project.

推荐答案

在解决方案资源管理器中标记所有需要的项目.

Mark all the desired projects in solution explorer.

按 Alt-F7 或右键单击解决方案资源管理器并选择属性"

Press Alt-F7 or right click in solution explorer and select "Properties"

配置:所有配置

点击预处理器定义行以调用其编辑器

Click on the Preprocessor Definitions line to invoke its editor

选择编辑...

将_CRT_SECURE_NO_WARNINGS"复制到顶部的预处理器定义白框中.

Copy "_CRT_SECURE_NO_WARNINGS" into the Preprocessor Definitions white box on the top.

这篇关于默认情况下,在 Visual Studio 中从项目中删除安全警告 (_CRT_SECURE_NO_WARNINGS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Rising edge interrupt triggering multiple times on STM32 Nucleo(在STM32 Nucleo上多次触发上升沿中断)
How to use va_list correctly in a sequence of wrapper functions calls?(如何在一系列包装函数调用中正确使用 va_list?)
OpenGL Perspective Projection Clipping Polygon with Vertex Outside Frustum = Wrong texture mapping?(OpenGL透视投影裁剪多边形,顶点在视锥外=错误的纹理映射?)
How does one properly deserialize a byte array back into an object in C++?(如何正确地将字节数组反序列化回 C++ 中的对象?)
What free tiniest flash file system could you advice for embedded system?(您可以为嵌入式系统推荐什么免费的最小闪存文件系统?)
Volatile member variables vs. volatile object?(易失性成员变量与易失性对象?)