为什么这个Boost Spirit示例没有编译?

时间:2012-10-17 20:49:30

标签: c++ boost compiler-construction calculator boost-spirit

我决定学习提升精神并开始研究here。但是,我很失望,因为第一个示例calc1.cpp没有在我的计算机上编译,它给出了此错误消息:

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_’

我添加了这样的一行,但这不是解决方案:

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

我该怎么办?提前谢谢。

1 个答案:

答案 0 :(得分:3)

您正尝试在Boost 1.46.1的安装中使用Boost 1.51.0中的示例。

而不是您正在使用的演示,请尝试以下方法:http://www.boost.org/doc/libs/1_46_1/libs/spirit/example/qi/calc1.cpp