c++boostcalculatorboost-spirit

Why is this Boost Spirit example not compiling?


I decided to learn Boost Spirit and started studying look here. But, I am disappointed because the very first example calc1.cpp isn't compiling on my computer and it gives this error message:

calc1.cpp: In constructor ‘client::calculator<Iterator>::calculator()’:
calc1.cpp:43:13: error: ‘uint_type’ is not a member of ‘client::qi’
calc1.cpp:43:27: error: expected ‘;’ before ‘uint_’
calc1.cpp:60:17: error: ‘uint_’ was not declared in this scope
calc1.cpp:60:17: note: suggested alternatives:
/usr/include/boost/spirit/home/support/common_terminals.hpp:134:1: note:   ‘boost::spirit::uint_’
/usr/include/boost/spirit/home/support/common_terminals.hpp:134:1: note:   ‘boost::spirit::tag::uint_’
/usr/include/boost/spirit/home/support/common_terminals.hpp:134:1: note:   ‘boost::spirit::uint_’

I added a line like this, but this is not the solution:

#include <boost/spirit/home/support/common_terminals.hpp>

What should i do? Thanks, in advance.


Solution

  • You are attempting to use an example from Boost 1.51.0 on an installation of Boost 1.46.1.

    Instead of the demo you are using, try this one: http://www.boost.org/doc/libs/1_46_1/libs/spirit/example/qi/calc1.cpp