0

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.

Bill Lynch
  • 80,138
  • 16
  • 128
  • 173
Barış Akkurt
  • 2,255
  • 3
  • 22
  • 37
  • 2
    What's your boost version? This example is from 1.51 and it, of course, compiles on 1.51: http://liveworkspace.org/code/0218209d4c3f7475daae44754d4891a6 – Cubbi Oct 17 '12 at 21:17
  • I have the latest Spirit which is I guess not 1.51. How can i translate it to the latest version, any idea? – Barış Akkurt Oct 17 '12 at 21:24
  • The latest version of Boost / Spirit is 1.51.0 unless you're using the 1.52.0.beta1. What is the value of `BOOST_VERSION` in `/usr/include/boost/version.hpp`? – Bill Lynch Oct 17 '12 at 21:26
  • My Boost version is 1.46.1 (#define BOOST_VERSION 104601) and I am using Ubuntu 11.04, I installed the Boost via package manager. – Barış Akkurt Oct 17 '12 at 21:31

1 Answers1

3

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

Bill Lynch
  • 80,138
  • 16
  • 128
  • 173