How to use _CRT_SECURE_NO_WARNINGS(如何使用_CRT_SECURE_NO_WARNINGS)
问题描述
在我的简单 MFC 窗口应用程序中,我有几行代码从向导生成的编译错误:
I have compile error in my simple MFC window application generated from wizard with several lines of code:
错误 C4996:'strncpy':此函数或变量可能不安全.考虑使用 strncpy_s 代替.要禁用弃用,请使用 _CRT_SECURE_NO_WARNINGS.有关详细信息,请参阅在线帮助.
error C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
我设置Configuration Properties>>C/C++>>Preporocessor>>Preprocessor Definitions>>_CRT_NONSTDC_NO_WARNINGS
但这无济于事.我有另一个非常接近的项目,它只在这个地方生成警告,并且没有 _CRT_NONSTDC_NO_WARNINGS
定义.
But this does't helped. I have another very close project that generates only warning in this place and it has no _CRT_NONSTDC_NO_WARNINGS
definition.
项目之间的唯一区别是向导中有几个不同的选项.
Only difference between projects is several different options in wizard.
为什么 _CRT_NONSTDC_NO_WARNINGS 在第一个项目中没有帮助,为什么第二个项目在没有这个定义的情况下编译没有问题?
Why _CRT_NONSTDC_NO_WARNINGS does not helps in first project and why second project compiles without problems without this definition?
推荐答案
添加者
配置属性>>C/C++>>预处理器>>预处理器定义>> _CRT_SECURE_NO_WARNINGS
Configuration Properties>>C/C++>>Preporocessor>>Preprocessor Definitions>> _CRT_SECURE_NO_WARNINGS
这篇关于如何使用_CRT_SECURE_NO_WARNINGS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用_CRT_SECURE_NO_WARNINGS


- 静态初始化顺序失败 2022-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 从python回调到c++的选项 2022-11-16
- STL 中有 dereference_iterator 吗? 2022-01-01
- 近似搜索的工作原理 2021-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- C++ 协变模板 2021-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07