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