Question

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
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top