使用vs2012配置opencv编译出现问题:error C4996: 'fopen': This function or variable may be unsafe.
编译结果如下:1>------ 已启动生成: 项目: LoadPicture, 配置: Debug Win32 ------
1> stdafx.cpp
1> LoadPictureDlg.cpp
1>d:\opencv\opencv\build\x86\vc11\include\opencv2\flann\logger.h(66): 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> c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h(218) : 参见“fopen”的声明
1> LoadPicture.cpp
1>d:\opencv\opencv\build\x86\vc11\include\opencv2\flann\logger.h(66): 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> c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h(218) : 参见“fopen”的声明
1> CvvImage.cpp
1>d:\opencv\opencv\build\x86\vc11\include\opencv2\flann\logger.h(66): 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> c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h(218) : 参见“fopen”的声明
1> 正在生成代码...
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
解决办法如下:
找到Debug属性页C/C++下得预处理器
在预处理定义的
WIN32
_WINDOWS
_DEBUG下添加_CRT_SECURE_NO_WARNINGS
这个问题只有在Visual Studio 2012中才会有,2010中只是一个warning。
我的opencv是246的