做数字图像处理作业,使用vs2012,遇到如下错误。
1>------ 已启动生成: 项目: 20130925, 配置: Debug Win32 ------
1> stdafx.cpp
1>d:\code\20130925\20130925\stdafx.cpp(18): error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> d:\vs2012\vc\include\stdio.h(218) : 参见“fopen”的声明
1> 20130925.cpp
1> 正在生成代码...
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
解决方案,项目 =》属性 =》c/c++ =》预处理器=》点击预处理器定义,编辑,加入_CRT_SECURE_NO_WARNINGS,即可。
类似错误:
错误: error C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. 的处理方法
在VS2013下如果使用strcpy有时候会报这个错误,解决方法是找到该项目的属性:
在预处理定义中添加:
_CRT_SECURE_NO_WARNINGS
即可
错误 5 error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 2132 1 DNN