Here is my sample flex file,
%{
/* need this for the call to getlogin() below */
#include <unistd.h>
%}
%%
username printf("%s\n", getlogin());
%%
main()
{
yylex();
}
I ran the following command,
$ flex sample.fl
I could see the lex.yy.c file now.
I ran the following gcc command
$ gcc lex.yy.c -lfl
and got the following error,
/usr/bin/ld: cannot find -lfl
collect2: ld returned 1 exit status
I already have flex installed in my computer.