Visual Studio的函数unsafe报错问题

经常在Visual Studio中遇到如下的编译问题:

错误  1   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.    d:\opencv2.4.8\opencv\build\include\opencv2\flann\logger.h  66  1   cvBlob

就是提示不安全问题,类似的问题还有printf_s等,解决的办法在编译信息中也提示了,就是添加_CRT_SECURE_NO_WARNINGS忽略。具体的做法是:
Project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions中添加_CRT_SECURE_NO_DEPRECATE就OK了。

参考:Stack Overflow

你可能感兴趣的:(Visual,Studio)