我正在尝试在 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_'
如果我需要包含更多信息,请告诉我。
是否有任何我需要设置的编译器标志,或者我可能错过的其他东西?
提前致谢。
最佳答案
您必须将 $CG_BOOST_ROOT 更改为 $CG_64_BOOST_ROOT 才能使用 BCC32C (CLANG) 获得随附的 BOOST 1.55 而不是 1.39:
阅读此处:http://docwiki.embarcadero.com/RADStudio/Seattle/en/Boost
关于c++ - 使用 Clang 编译 Boost 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34346981/