How can I print the line number on which an error occurred. I tried using yylineno
in the yyerror()
function and writing %option yylineno
in the .l
file but after compiling it gives me an error "yylineno undeclared (first use in this function)
" and if I initialize yylineno
as 1 it gives me this error:
error: redefinition of yylineno
lex.yy.c:273: note: previous definition of yylineno was here