VS2013编译程序出现error C4996: 'std::_Fill_n': Function call with parameters that may be unsafe

 最近按照BiliBil网站Visual C++网络项目实战视频教程,使用VS2013编写一个基于MFC的对话框程序HttpSourceViewer,采用了WinHttp库、Boost xpressive正则库等,学到第23课,使用正则表达式时,出现如下错误:

错误	1	error C4996: 'std::_Fill_n': 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'	
d:program filesmicrosoft visual studio 12.0vcincludexutility	2715	1	HttpSourceViewer

	2	IntelliSense:  命令行错误: 宏定义无效: -D_SCL_SECURE_NO_WARNINGS	
f:SoftDevelopCPlusVCProject2013HttpSourceViewerHttpSourceViewerRegExpBoost.cpp	1	1	
HttpSourceViewer

google搜索error C4996: 'std::_Fill_n': Function call with parameters that may be unsafe

找到如下解决方案:

右键单击HttpSourceViewer项目,选择

属性-> cc++ -> 预处理器 -> 预处理器定义 里添加
_SCL_SECURE_NO_WARNINGS 编译成功

参考资料:

1、【C++】错误 164 error C4996: 'std::_Fill_n':

2、error C4996: Function call with parameters that may be unsafe – this call relies on the caller to check that the passed values are correct

原文地址:https://www.cnblogs.com/ccf19881030/p/12004822.html