Boost.Spirit mini_xml2.cpp 示例无法被 C++11, Boost 1.55 编译 [英] Boost.Spirit mini_xml2.cpp example could not be compiled by C++11, Boost 1.55

查看:20
本文介绍了Boost.Spirit mini_xml2.cpp 示例无法被 C++11, Boost 1.55 编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

c++0x 编译器无法编译 boost.spirit 示例 mini_xml2.cpp(并且没有来自非 c++0x 编译器的错误)

c++0x compiler fails to compile boost.spirit example mini_xml2.cpp (and no errors from not c++0x compiler)

$> c++ -std=c++0x mini_xml2.cpp (errors)
$> c++ mini_xml2.cpp (no errors)

错误日志放在这里.我怀疑该问题与非终结符属性有关(第 159-163 行),但我可能是错的.

The error log is placed here. I suspect that problem is related to nonterminal attributes (lines 159-163), but I could be wrong.

  • c++ 版本(Ubuntu/Linaro 4.8.1-10ubuntu9)4.8.1
  • Boost 1.55 版

我在 boost 跟踪器上创建了问题,但没有回答.

I've created issue at the boost tracker, but have no answer.

有人有同样的错误吗?

已解决:我在此处找到了解决方案.

Solved: I found a solution here.

// Add this macro
#define BOOST_SPIRIT_USE_PHOENIX_V3

推荐答案

如上所述,在现代编译器上,您实际上需要使用 Phoenix V3,因为 Phoenix V2 依赖于结果协议,在较新版本的 boost 库中,它不再总是包含在内.

As indicated, on modern compilers you will actually need to use Phoenix V3, as Phoenix V2 relies on the old result-of protocol, which in newer versions of boost libraries just isn't always included anymore.

此外,在某些编译器(AFAIK 至少是 clang)上,BOOST_RESULT_OF_USE_DECLTYPE 方法默认启用,这可能导致支持库忽略(成本更高的)TR1 结果协议.

Additionally on some compilers (AFAIK at least clang) the BOOST_RESULT_OF_USE_DECLTYPE approach is enabled by default, which may cause the supporting libraries to omit the (more costly) TR1 result-of protocol.

好消息是,在我们在用户列表作为反复出现的绊脚石,官方决定在这里:

The good news is, after we signaled this on the user list as a recurring stumbling block, the official decision is here:

告别凤凰-2 2013 年 12 月 14 日;凌晨 3:38(乔尔·德·古兹曼)
(也博文)

Boost C++... 十多年后,我终于将 Phoenix-2 从Boost Spirit 代码库.我很难过.这就像告别一个好朋友.向前到 Phoenix-3.

Boost C++... After more than a decade, I finally retired Phoenix-2 from the Boost Spirit code base. I feel sad. It's like farewell to a good friend. Onwards to Phoenix-3.

那只是 7 天前:)

所以在(不久的)将来这个问题将得到解决.

So in the (near) future this problem will have been resolved.

这篇关于Boost.Spirit mini_xml2.cpp 示例无法被 C++11, Boost 1.55 编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆