无法编译任何example 在Ubuntu 16.04上
$ g++ -std=c++14 main.cpp
In file included from /usr/include/boost/spirit/home/x3/nonterminal.hpp:14:0,
from /usr/include/boost/spirit/home/x3.hpp:20,
from main.cpp:23:
main.cpp:226:9: error: ‘client::calculator_grammar::parse_rule’ declared as an ‘inline’ variable
BOOST_SPIRIT_DEFINE(
^
main.cpp:226:9: error: expected ‘)’ before ‘rule_’
BOOST_SPIRIT_DEFINE(
^
main.cpp:226:9: error: expected primary-expression before ‘&’ token
BOOST_SPIRIT_DEFINE(
^
main.cpp:226:9: error: ‘first’ was not declared in this scope
BOOST_SPIRIT_DEFINE(
^
这是一个精灵:: x3错误?
答案 0 :(得分:2)
两个变化:
添加遗漏的包含
#include <boost/foreach.hpp>
选择“新风格”宏用法:
BOOST_SPIRIT_DEFINE(expression , term , factor);
说实话,我不知道p = p_def
样式初始化是可能的。我怀疑这是X3发布之前所需的语法。