【问题标题】:Why is this Boost Spirit example not compiling?为什么这个 Boost Spirit 示例无法编译?
【发布时间】:2012-10-17 20:49:29
【问题描述】:

我决定学习Boost Spirit并开始学习look 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>

我该怎么办?提前谢谢。

【问题讨论】:

  • 你的 boost 版本是什么?此示例来自 1.51,当然,它在 1.51 上编译:liveworkspace.org/code/0218209d4c3f7475daae44754d4891a6
  • 我有最新的 Spirit,我猜不是 1.51。我怎样才能把它翻译成最新版本,知道吗?
  • Boost / Spirit 的最新版本是 1.51.0,除非您使用的是 1.52.0.beta1。 /usr/include/boost/version.hppBOOST_VERSION的值是多少?
  • 我的 Boost 版本是 1.46.1 (#define BOOST_VERSION 104601),我使用的是 Ubuntu 11.04,我通过包管理器安装了 Boost。

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


【解决方案1】:

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

代替您使用的演示,试试这个:http://www.boost.org/doc/libs/1_46_1/libs/spirit/example/qi/calc1.cpp

【讨论】:

    猜你喜欢
    • 2011-07-23
    • 2011-12-29
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多