其他分享
首页 > 其他分享> > 解决VS2017中出现'strcpy': This function or variable may be unsafe. Consider using strcpy_s inst

解决VS2017中出现'strcpy': This function or variable may be unsafe. Consider using strcpy_s inst

作者:互联网

当运行C++程序时,出现下面错误:

1>------ Build started: Project: Windows 编程, Configuration: Debug Win32 ------

1> Source.cpp

1>d:\personal\documents\visual studio 2013\projects\windows 编程\windows 编程\source.cpp(42): error C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

1> d:\program files (x86)\microsoft visual studio 12.0\vc\include\string.h(204) : see declaration of 'strtok'

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

解决方法:

找到【项目属性】,点击【C++】里的【预处理器】,对【预处理器】进行编辑,在里面加入一段代码:_CRT_SECURE_NO_WARNINGS。

图示:

————————————————
版权声明:本文为CSDN博主「小小谢先生」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/xiewenrui1996/article/details/90582550

标签:function,Consider,CRT,strtok,编程,strcpy,Build,------,using
来源: https://www.cnblogs.com/wwssgg/p/15538309.html