代码之家  ›  专栏  ›  技术社区  ›  Sreeraj Chundayil

boost信号2未编译

  •  0
  • Sreeraj Chundayil  · 技术社区  · 6 年前

    当我只是添加一个标题 #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 网站和安装。我正在使用VS 2017。我已将路径添加到库,属性中的头如下所示。

    配置属性->链接->常规->附加库 目录为C:\ boost_1_69_0\lib64-msvc-14.1;

    配置属性->包括添加了其他文件夹的目录 C:\增压器1_69_0;

    edit2:通过在中添加-d_scl_secure_no_警告解决了问题

    配置属性-gt;C/c++ +gt;命令行。

    1 回复  |  直到 6 年前
        1
  •  0
  •   gordan.sikic    6 年前

    我假设你是在windows上编译,使用vs 2017。

    C4996实际上是一个警告( compiler warning C4996 ),而不是错误,因此您可能已经激活了将所有警告视为错误的选项。若要检查,请右击目标属性,然后展开“C/C++”,并转到一般属性,如以下快照所示:

    enter image description here

    enter image description here

    如果我的假设是错误的,请添加必要的信息(compiler/os/如何获得boost,它是否正确编译,…),这样我们可以找到更好的答案。

    编辑: 因为您声明没有更改编译选项,所以应该搜索源代码 #pragma warninng(error:....) 在源代码的某个地方。