Search code examples
c++c++11boostboost-spiritboost-spirit-qi

Compile Boost Spirit Keyword Parser Example


I am having some trouble compiling the example code for boost keyword parser. I am using boost 1.63.0 and gcc 6.3.0 and specifying c++ 11. I ran:

g++ -std=c++11 -I boost-1.63-0/include keywords-1.cpp

and was hit by a massive wall of compiler errors. The first error was:

no type named 'type' in struct boost::mpl::apply...

I also tried compiling the example using gcc 4.8.2 with the c++ 11 flag turned on with boost 1.55.0 and also received a similarly large wall of errors. However, trying to compile the example with c++ 03, both compilers and boost versions worked.

I have tried compiling on Centos 5 and Ubuntu 14.04. The specific example I am referencing can be found under spirit/repository/example/qi/keywords.cpp

Does anyone know if the keyword parser is will compile in c++11, or should I go back to using the Nabialek trick for these purposes? Or does anyone have any points in the correct direction or hints as to what I am doing incorrect?


Solution

  • I believe I have the answer I tried compiling with g++ -I boost-1.63.0/include -DBOOST_RESULT_OF_USE_TR1 ~/keywords.cpp and it compiles. This solution was found in a bug report here: https://svn.boost.org/trac/boost/ticket/11493