在編譯c++程序時報如下錯:
error C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
error C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
在網上找到的解決方法如下:
1. 加入 #define _CRT_SECURE_NO_WARNINGS
2. 加入 #pragma warning (disable: 4996)
3. (你的項目)-->右鍵 --> 屬性, 進去以后,在C++ --> 高級 --> 禁用特定警告 中添加:4996

4. (你的項目)-->右鍵 --> 屬性, 進去以后,在C++ --> 預處理器 --> 預處理器定義 中添加:_CRT_SECURE_NO_WARNINGS

5. 如果使用“win32應用程序向導”創建項目時,可以將“安全開發生命周期(SDL)檢查”的選項去掉
參考文檔:
https://jingyan.baidu.com/article/ce436649fd61543773afd32e.html
https://blog.csdn.net/sdujava2011/article/details/41177699
