与Clang编译Boost的错误
问题描述:
我想在C++ Builder(embarcadero)的应用程序中使用boost,当包含boost/filesystem.hpp和编译与Clang时,我收到了一些非常奇怪的错误,而我只是似乎无法弄清楚是什么原因造成的。与Clang编译Boost的错误
的错误是这样的:使用该函数BOOST_MPL_AUX_LAMBDA_SUPPORT()
时发生
[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'
所有这些错误,他们似乎只使用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
您可以发布[代码说明问题] (https://stackoverflow.com/help/mcve)? –
感谢您的评论。它甚至发生,即使我只是创建一个空的项目,并包括boost/filesystem.hpp,虽然fx boost/thread/once.hpp工作正常。 –
发布您的IDE正在生成的clang命令行。 – rhashimoto