1

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.

4

1 回答 1

1

在我的 Fedora 盒子中安装flex-static.i686包解决了这个问题。

于 2013-04-25T10:16:18.530 回答