本文主要是介绍【VC】warning C4996: 'XXXX': This function or variable may be unsafe.,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
关于VS系列使用 Unicode 格式产生以上警告:
warning C4996: 'wcscpy': This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
MSDN
Generic-Text Routine MappingsTCHAR.H Routine _UNICODE Defined
_tcscpy wcscpy
解决方案
项目 ->属性 -> c/c++ -> 预处理器 -> 预处理器定义,加入 _CRT_SECURE_NO_WARNINGS,即可。
Deprecated function | Security-enhanced replacement |
---|---|
_alloca | _malloca |
asctime | asctime_s |
_cgets, _cgetws | _cgets_s, _cgetws_s |
_chsize | _chsize_s |
_controlfp | _controlfp_s |
_creat | _sopen_s |
_cscanf | _cscanf_s |
_cscanf_l | _cscanf_s_l |
ctime | ctime_s |
_ctime32 | _ctime32_s |
_ctime64 | _ctime64_s |
_cwscanf | _cwscanf_s |
_cwscanf_l | _cwscanf_s_l |
_ecvt | _ecvt_s |
_fcvt | _fcvt_s |
fopen | fopen_s |
freopen |
这篇关于【VC】warning C4996: 'XXXX': This function or variable may be unsafe.的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!