PHP扩展开发(6) - VS2012下strncasecmp和fopen函数warning

时间:2023-03-09 04:53:53
PHP扩展开发(6) - VS2012下strncasecmp和fopen函数warning

1. fopen

warning 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 12.0\VC\include\stdio.h(211) : see declaration of 'fopen'

解决方法:
加宏      _CRT_SECURE_NO_WARNINGS
右键项目 -> 属性 -> 预处理(Preprocessor) -> 预处理定义(Preprocessor Definitions) -> 把宏加进去
2. strncasecmp、strnicmp
 'strnicmp': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.
1>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\string.h(255) : see declaration of 'strnicmp'
解决方法:
加宏
_CRT_SECURE_NO_DEPRECATE=1
_CRT_NONSTDC_NO_DEPRECATE=1
右键项目 -> 属性 -> 预处理(Preprocessor) -> 预处理定义(Preprocessor Definitions) -> 把宏加进去