[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++/STL] string字符串关于copy函数的C4996错误
- C/C++关于字符串string、char*字符串数组与其他类型转换
- C++:关于string转C-风格字符串
- C/C++中求字符串数组的大小---sizeof,strlen,string,length()
- 关于stringByReplacingCharactersInRange过滤字符串的问题
- C字符串和C++中string的区别 &&&&C++中int型与string型互相转换
- C/C++中关于字符串数组与字符串常量
- c++中string类型字符串的使用
- C++ STL-string实例
- 20170114C++阶段班04_STL_01string
- linux c++ stl hash_map basic_string 使用
- C++下面关于字符串数组的一些操作
- 关于Java字符串(String)10个最常见问题
- C++学习笔记(字符串string、vector_deque、queue,multiset、map、multimap、容器拷贝问题)
- 关于String字符串的""值问题以及for增强循环
- 请用c++ 实现stl中的string类,实现构造,拷贝构造,析构,赋值,比较,字符串相加,获取长度及子串等功能
- C++模版STL中 map 和 string, vector 的用法详解!
- LeetCode 8. String to Integer (atoi) C++ --字符串转为数字,包含正负号、空格、字母、数字等字符
- C++(13)STL实践与分析之再谈String类型
- Binary String Matching 字符串的查找匹配 STL