[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: undefined symbol for the c++ parser::error() function
From: |
Akim Demaille |
Subject: |
Re: undefined symbol for the c++ parser::error() function |
Date: |
Sun, 6 Jun 2021 08:26:01 +0200 |
Hi Scott,
> Le 3 juin 2021 à 00:13, Scott Lorberbaum <ugascottl@gmail.com> a écrit :
>
> My namespace is ucc;
> I've named the parser uccParser;
>
>
> This function below I find in the generated ucc.tab.cpp file
> void
> uccParser::error (const syntax_error& yyexc)
> {
> error (yyexc.location, yyexc.what ());
> }
> unfortunately the ucc.tab.hpp file that is generated does not include a
> definition of this function inside the class it creates.
You are in charge of defining the error reporting function, just like
you are in charge of defining yylex.
Most people use a simple definition:
void
yy::parser::error (const location_type& l, const std::string& m)
{
std::cerr << l << ": " << m << '\n';
}
Please see the documentation. For instance
https://www.gnu.org/software/bison/manual/html_node/A-Simple-C_002b_002b-Example.html
Cheers!