我正在使用 boost (1.77) 灵气和词法分析器。错误处理程序需要一个字符流,但我向它传递了一个标记流,导致出现乱码错误消息。
我相信下面的线程指向一个解决方案:
Boost.Spirit: Lex + Qi error reporting
在评论中,@hkaiser 写道:
Just an update: the example has been renamed in SVN to conjure2.
我刚刚看了一眼 conjure2。为了理解程序的作用,我打开 main.cpp 并阅读注释,我发现的是:
Not a calculator anymore, right? :-)
这是什么意思?
我试图编译程序,但失败了:
"error C2516: 'boost::phoenix::evaluator::impl<const Expr&,
boost::phoenix::vector2boost::mpl::true_,
boost::phoenix::is_nullary,boost::proto::envns_::empty_env>::result_type':
is not a legal base class"
我做错了什么?
最佳答案
修复方法是将它放在 lexer_def.hpp 的顶部:
#include <boost/phoenix/operator.hpp>
这应该定义缺少的表达式模板运算符,以防止编译词法分析器语义操作。
https://stackoverflow.com/questions/70433905/