I wrote gcc lex.yy.c -o ornek -lfl
in command line. Then I get an error as follows:
/usr/bin/ld: cannot find -lfl
collect2: error: ld returned 1 exit status
How can I solve this problem?
I wrote gcc lex.yy.c -o ornek -lfl
in command line. Then I get an error as follows:
/usr/bin/ld: cannot find -lfl
collect2: error: ld returned 1 exit status
How can I solve this problem?
You need to separately install libfl-dev
in order to have the fl
library.
But you probably don't need that library. It only provides two things, neither of which is particularly useful:
A do-nothing definition of yywrap
. Instead if using this, avoid the need by placing
%option noyywrap
in the first section of your flex file.
A definition of main
which just calls yylex
repeatedly. Normally, you will want to write a more interesting main
function. But if you want to duplicate the default provided in -lfl
, it looks basically like this:
int main(void) {
while(yylex()) { }
return 0;
}