C4996 ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_s instead.运行出错问题 解决方案

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 C4996 ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. MyString F:\vsCode\xxx\xxx\xxx.cpp 17

问题及解决:
如图所示
C4996 ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_s instead.运行出错问题 解决方案
使用strcpy,strcat等函数安全性过低,会报警告
解决办法:
在目标头文件中添加
#define _CRT_SECURE_NO_WARNINGS
C4996 ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_s instead.运行出错问题 解决方案
或者添加到main函数文件中
C4996 ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_s instead.运行出错问题 解决方案
即可成功
C4996 ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_s instead.运行出错问题 解决方案