Boost.Spirit mini_xml2.cpp example could not be compiled by C++11, Boost 1.55

给你一囗甜甜゛ 提交于 2019-12-29 01:42:06

问题


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)

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

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

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

Does anybody have the same errors?

Solved: I found a solution here.

// Add this macro
#define BOOST_SPIRIT_USE_PHOENIX_V3

回答1:


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.

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:

Farewell Phoenix-2 Dec 14, 2013; 3:38am (Joel de Guzman)
(also blog post)

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.

That's just 7 days ago :)

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



来源:https://stackoverflow.com/questions/20721486/boost-spirit-mini-xml2-cpp-example-could-not-be-compiled-by-c11-boost-1-55

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!