【问题标题】:Errors when compiling project using boost library in Xcode在 Xcode 中使用 boost 库编译项目时出错
【发布时间】:2016-05-29 15:54:22
【问题描述】:

我正在使用通过自制软件安装的 boost,并添加了 'usr/local/include' 来搜索头文件路径,并添加了 'usr/local/lib' 来搜索库路径。它包含的很好,但编译时出现以下错误:

/usr/local/include/boost/move/unique_ptr.hpp:549:16: Unknown type name 'BOOST_RV_REF_BEG_IF_CXX11'

/usr/local/include/boost/move/unique_ptr.hpp:549:42: 'unique_ptr' cannot be the name of a parameter

/usr/local/include/boost/move/unique_ptr.hpp:549:59: Expected ')'

/usr/local/include/boost/move/unique_ptr.hpp:552:16: Use of undeclared identifier 'u'

这些是 boost 代码中的违规行:

   template <class U, class E>
   unique_ptr( BOOST_RV_REF_BEG_IF_CXX11 unique_ptr<U, E> BOOST_RV_REF_END_IF_CXX11 u
      BOOST_MOVE_DOCIGN(BOOST_MOVE_I typename bmupd::enable_up_moveconv_constr<T BOOST_MOVE_I D BOOST_MOVE_I U BOOST_MOVE_I E>::type* =0)
      ) BOOST_NOEXCEPT
      : m_data(u.release(), ::boost::move_if_not_lvalue_reference<E>(u.get_deleter()))
   {
      //If T is not an array type, U derives from T
      //it uses the default deleter and T has no virtual destructor, then you have a problem
      BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor
                            <D, typename unique_ptr<U, E>::pointer>::value ));
   }

【问题讨论】:

  • Stackoverflow 不是任何项目的错误跟踪器:您的意思是向 Boost 提交错误报告吗?否则,你的问题是什么?

标签: c++ xcode boost


【解决方案1】:

我收到此错误的原因是因为我在 xcode 中将 /usr/local/include 添加到“标头搜索路径”而不是“用户标头搜索路径”中。不知道为什么会导致此错误,可能没有包含某些内容,但将其添加到两者中修复了它。

为了让 boost 充分发挥作用,我还必须在 Build Phases 中将 .dylib(来自 /usr/local/lib)添加到“Link Binary With Libaries”中。

【讨论】:

    猜你喜欢
    • 2018-11-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-24
    • 2022-08-16
    • 2016-02-25
    • 1970-01-01
    • 1970-01-01
    • 2013-09-15
    相关资源
    最近更新 更多