Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
239 views
in Technique[技术] by (71.8m points)

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

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...