您的位置:首页 > 编程语言 > C语言/C++

[C++/STL] string字符串关于copy函数的C4996错误

2017-10-19 14:16 381 查看

原文地址:http://blog.csdn.net/qq_15567051/article/details/49982735


今天晚上,在使用Visual Stdio 2013使用string类的copy函数时,编译出现以下错误:

error C4996: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::copy': Function call with parameters that may be unsafe - this call relies on the caller to check
that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'

解决办法:
     右键项目-->属性--> 【通用配置】/【c/c++】/ 【预处理器】中第一行 【预处理器定义】中右边点击编译 ,在最下方加入_SCL_SECURE_NO_WARNINGS 确定即可;
注意:  添加的是_SCL_SECURE_NO_WARNINGS 去掉提示错误-D_SCL_SECURE_NO_WARNINGS前面的-D ;

特在此记录,希望遇到同样错误不能解决的学友们可按此方法解决;

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c++