【问题标题】:Errors when compiling Boost with Clang使用 Clang 编译 Boost 时出错
【发布时间】:2015-12-18 01:00:58
【问题描述】:

我正在尝试在 C++ Builder (embarcadero) 中的应用程序中使用 boost,但在包含 boost/filesystem.hpp 和使用 Clang 编译时遇到了一些非常奇怪的错误,我似乎无法理解找出是什么原因造成的。

错误如下所示:

[CLANG Error] logical_op.hpp(145): unknown type name 'or__rebind'
[CLANG Error] if.hpp(72): unknown type name 'if__rebind'
[CLANG Error] eval_if.hpp(43): unknown type name 'eval_if_rebind'
[CLANG Error] identity.hpp(28): unknown type name 'identity_rebind'
[CLANG Error] identity.hpp(37): unknown type name 'make_identity_rebind'
[CLANG Error] not.hpp(44): unknown type name 'not__rebind'

所有这些错误都是在使用BOOST_MPL_AUX_LAMBDA_SUPPORT() 函数时发生的,而且它们似乎只在使用 Clang 时发生。代码使用 Borlands 自己的编译器编译得很好。

即使它是一个全新的项目也会发生,我添加的唯一行是#include <boost/filesystem.hpp>。

编辑:我刚刚尝试包含<boost/thread.hpp>,这是抛出的错误的片段:

[CLANG Error] greg_month.hpp(62): type 'greg_month_rep' (aka 'constrained_value<greg_month_policies>') is not a direct or virtual base of 'boost::gregorian::greg_month'
[CLANG Error] greg_month.hpp(64): type 'greg_month_rep' (aka 'constrained_value<greg_month_policies>') is not a direct or virtual base of 'boost::gregorian::greg_month'
[CLANG Error] greg_month.hpp(68): use of undeclared identifier 'value_'
[CLANG Error] greg_month.hpp(69): use of undeclared identifier 'value_'

如果我需要提供更多信息,请告诉我。

是否有任何我需要设置的编译器标志,或者我可能错过的其他东西?

提前致谢。

【问题讨论】:

  • 感谢您的评论。即使我只是创建一个空项目并包含 boost/filesystem.hpp,它也会发生,尽管 fx boost/thread/once.hpp 工作正常。
  • 发布你的IDE正在生成的clang命令行。
  • 您使用的是哪个版本的 boost 和哪个版本的 C++Builder? boost 中有很多宏扩展依赖于正确匹配的版本,很容易使它们不同步。

标签: c++ boost clang c++builder


【解决方案1】:

您必须将 $CG_BOOST_ROOT 更改为 $CG_64_BOOST_ROOT 才能使用 BCC32C (CLANG) 来获得出厂的 BOOST 1.55 而不是 1.39:

在这里阅读:http://docwiki.embarcadero.com/RADStudio/Seattle/en/Boost

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    相关资源
    最近更新 更多