Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio

10/14 13:51
阅读数 0

问题:

Is there a way to set by default for all projects removing the precompiler secure warnings that come up when using functions like scanf().有没有办法在默认情况下为所有项目设置删除使用 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.我发现您可以通过在项目选项中添加一行或在代码开头添加#define _CRT_SECURE_NO_WARNINGS来实现。

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.在代码的开头,或者每次启动新项目时在预编译器选项中设置它。


解决方案:

参考一: https://en.stackoom.com/question/18q33
参考二: https://stackoom.com/question/18q33
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部