我正在移植/更新一些非常古老的代码而且我的C ++不是很尖锐(我主要是C程序员)。我收到了这个错误 - 如何解决这个问题?有人可以解释这个烂摊子吗?注意第512行是结构定义 - 第一行?
In file included from src/aaa_dict_mngr.cxx:38:0:
./include/aaa_parser_avpvalue.h:512:41: error: expected template-name before '<' token
./include/aaa_parser_avpvalue.h:512:41: error: expected '{' before '<' token
./include/aaa_parser_avpvalue.h:512:41: error: expected unqualified-id before '<' token
违规代码:
struct DiamidentGrammar : public grammar<DiamidentGrammar>
{
template <typename ScannerT>
struct definition
{
definition(DiamidentGrammar const& self)
{
diameterIdentity = realm;
realm = label >> *('.' >> label); // No recursive rule allowed.
label = diameterName | diameterDname;
diameterName = alpha_p >> *(alnum_p | '-');
diameterDname = digit_p >> +(alnum_p | '-');
}
rule<ScannerT> diameterIdentity, realm, label, diameterName, diameterDname;
rule<ScannerT> const& start() const { return diameterIdentity; }
};
};
答案 0 :(得分:1)
这只是古老的灵魂代码。您需要使用经典的标头/命名空间:
哦,无论如何,升级! Spirit V2已有多年历史,SpiritX3即将来临
#include <boost/spirit/include/classic.hpp>
using namespace boost::spirit::classic;
struct DiamidentGrammar : public grammar<DiamidentGrammar>
{
template <typename ScannerT>
struct definition
{
definition(DiamidentGrammar const& self)
{
diameterIdentity = realm;
realm = label >> *('.' >> label); // No recursive rule allowed.
label = diameterName | diameterDname;
diameterName = alpha_p >> *(alnum_p | '-');
diameterDname = digit_p >> +(alnum_p | '-');
}
rule<ScannerT> diameterIdentity, realm, label, diameterName, diameterDname;
rule<ScannerT> const& start() const { return diameterIdentity; }
};
};
int main()
{
}