Visual C++ ~ error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.

這問題是發生在用OpenCV的時候

裡面有段code使用fopen

但vs覺得他不安全就不給編譯= =

解決方法就是改Preprocessor Definitions

Project -> Properties(Alt+F7) -> Configuration Properties -> C/C++ -> Preprocessor ->
Preprocessor Definitions.

新增

USE_STANDARD_FILE_FUNCTIONS
_CRT_SECURE_NO_WARNINGS

就可以了


reference
http://darmawan-salihun.blogspot.tw/2011/07/crtsecurenowarnings-error-message-in.html

沒有留言: