【疑難雜癥系列】API編譯報C4996'strncpy'...To disable deprecation, use _CRT_
API編譯報C4996 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.的解決方法

方式1
在項目-屬性-C/C++-常規(guī)-SDL檢查,更改為否。此方法可生成dll文件,但仍可能存在警告

方式2
在項目-屬性-C/C++-命令行-其他選項中,輸入:??? /D"*****", 注意*****指的是編譯后調(diào)試信息中提示的 use _CRT_SECURE_NO_WARNINGS,提示use什么就填入什么。比如:/D"_CRT_SECURE_NO_WARNINGS" 注意引號中無空格

方式三
采用 strcpy_c 函數(shù)
舉例:
strcpy(name, NORM_WEAR.c_str())? ?-->? ?syrcpy_c(name, strlen() + 1, NORM_WEAR.c_str())
參考:
【EDEM2022案例】利用VS編譯API接觸模型_嗶哩嗶哩_bilibili,3:30處
(33條消息) error C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead._38363517的博客-CSDN博客
(33條消息) warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead._魚C缸的博客-CSDN博客
05_Relative_Wear_嗶哩嗶哩_bilibili,25分左右