我正在使用 Visual Studio 2012 Ultimate 和以下 Boost Signals2 代码:https://github.com/cfobel/boost_signals2/blob/master/hello_world_0.cpp https://github.com/cfobel/boost_signals2/blob/master/hello_world_0.cpp它会生成以下错误:
c:\program files (x86)\microsoft visual studio 11.0\vc\include\xmemory(348): error C4996: 'std::_Uninitialized_copy0': 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'
1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xmemory(333) : see declaration of 'std::_Uninitialized_copy0'
1> c:\libraries\boost_1_52_0\boost\signals2\detail\auto_buffer.hpp(192) : see reference to function template instantiation '_FwdIt std::uninitialized_copy<I,boost::variant<T0_,T1>*>(_InIt,_InIt,_FwdIt)' being compiled
此代码与 Visual Studio 2012 C++ 不兼容吗?使用仍然安全吗?最后,我该如何按照建议进行更改?
谢谢
C4996 http://msdn.microsoft.com/en-us/library/ttcz0bys.aspx是有关使用已标记为已弃用的函数的警告。既然您将其视为错误,也许您有Treat Warning as Error (/WX)
选项已启用?
错误消息本身描述了禁用此功能的方法。添加_SCL_SECURE_NO_WARNINGS
项目预处理器定义的符号。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)