c++ - 升压信号2没有被编译
问题描述
#include <boost/signals2.hpp>
当我在 VS 中添加标题时
即使它能够找到标题,我也会收到以下错误。
1>signals.cpp
1>c:\apps\mvs15\vc\tools\msvc\14.10.25017\include\memory(53): error C4996: 'std::uninitialized_copy::_Unchecked_iterators::_Deprecate': Call to 'std::uninitialized_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'
1>c:\apps\mvs15\vc\tools\msvc\14.10.25017\include\memory(53): note: see declaration of 'std::uninitialized_copy::_Unchecked_iterators::_Deprecate'
1>c:\boost_1_69_0\boost\signals2\detail\auto_buffer.hpp(191): note: see reference to function template instantiation '_FwdIt *std::uninitialized_copy<I,boost::shared_ptr<void>*>(_InIt,_InIt,_FwdIt)' being compiled
我无法解决这个问题。但是我的Boost.Asio
库头文件工作正常并且代码是可编译的。所以我认为boost安装没有问题。
Edit1:我从boost网站下载了 windows prebuild 二进制文件并安装了。我正在使用VS 2017。我添加了库的路径,属性中的标题如下。
配置属性->链接->常规->附加库目录为 C:\boost_1_69_0\lib64-msvc-14.1;
配置属性->包含目录添加了附加文件夹 C:\boost_1_69_0;
Edit2:通过添加 -D_SCL_SECURE_NO_WARNINGS 解决了问题
配置属性->C/C++->命令行。
解决方案
我假设您正在使用 VS 2017 在 Windows 上进行编译。
C4996 实际上是一个警告(编译器警告 C4996),而不是错误,因此您可能已经激活了将所有警告视为错误的选项。要检查,请右键单击目标属性,然后展开“C/C++”,然后转到常规属性,如以下快照所示:
如果我的假设是错误的,请添加必要的信息(编译器/操作系统/您是如何获得 boost,是否正确编译,....),以便我们找到更好的答案。
编辑:由于您声明您没有更改编译选项,因此您应该在源代码中的某处搜索源代码以查找#pragma warninng(error:....)。
推荐阅读
- soundcloud - Soundcloud 用户收藏夹端点已删除?
- php - 如何在使用nginx的centos服务器中清除laravel应用程序的缓存
- reactjs - React,Redux - 创建对象后重定向(使用 URL 中的新对象 ID)
- c - 通过信号暂停和恢复进程
- pandas - 防止 pandas.interpolate() 外推
- sql - 基于查询结果的 SSIS 作业到电子邮件
- javascript - 仅在生产中出现意外的令牌“<”错误
- c# - 没有登录用户的 Microsoft Graph 访问邮箱
- node.js - 在(嵌套)try/catch/finally 块中处理 nodejs 中的错误
- javascript - Javascript:如果 js 匹配特定 URL,则发出警报()