You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This minimal flex file with C++ and main options causes a compiler error
/* cxxmain.l *//*a minimal C++ flex file that gives an undeclared yylex compiler errorrun with: flex cxxmain.l && g++ lex.yy.ccerror is:lex.yy.cc: In function 'int main()':lex.yy.cc:1572:2: error: 'yylex' was not declared in this scope*/
%option c++
%option main
%%
$ flex cxxmain.l && g++ lex.yy.cc
lex.yy.cc: In function'intmain()':lex.yy.cc:1572:2: error: 'yylex' was not declared in this scope
This minimal flex file with C++ and main options causes a compiler error
flex
andgcc
versionsThe issue is simple. The generated
main
inlex.yy.cc
calls the free functionyylex
instead of theyyFlexLexer::yylex
method.The reason is
flex.skl
does not handle the case for a C++ builtin mainHere's a proposed fix. I'll submit a PR if it's acceptable.
The text was updated successfully, but these errors were encountered: