1. 主页 > vs安装问题 > VS2017安装问题 >

解决Visual Studio2017中 error C4996问题

使用boost::split时编译器报C4996错误

#include <boost/algorithm/string.hpp>
void log(const std::string &multilineText)
{
	std::vector<std::string> textVec;
	boost::split(textVec, multilineText, boost::is_any_of("\r\n"));
	for (auto text : textVec) {
		text += "\n";
		OutputDebugStringA(text.c_str());
	}
}

c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\include\xutility(2483): error C4996: ‘std::copy::_Unchecked_iterators::_Deprecate’: Call to ‘std::copy’ 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++ > 命令行 > 其它选项中添加-D_SCL_SECURE_NO_WARNINGS

本文由VS软件圈(vssoft.net)发布,不代表VS软件圈立场,转载联系作者并注明出处:https://vssoft.net/vsazwt/VS2017anzhuangwenti/2020/0725/4415.html

联系我们

在线咨询:点击这里给我发消息

微信号:PREEE8

工作日:9:30-18:30,节假日休息