解决Visual Studio2017中 error C4996问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiongya8888/article/details/84929845

使用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

猜你喜欢

转载自blog.csdn.net/xiongya8888/article/details/84929845