Saturday, February 21, 2009

undefined reference to _yywrap

cygwin,

$flex ch1-02.l
$gcc lex.yy.c -o ch1-02.exe
/cygdrive/d/Profiles/E6097C/LOCALS~1/Temp/ccFsaC7D.o:lex.yy.c:(.text+0x36c): und
efined reference to `_yywrap'
/cygdrive/d/Profiles/E6097C/LOCALS~1/Temp/ccFsaC7D.o:lex.yy.c:(.text+0xac1): und
efined reference to `_yywrap'
collect2: ld returned 1 exit status

solution: compile it with -lfl option.

gcc lex.yy.c -o ch1-02.exe -lfl

- Mihir Patel

5 comments:

pip said...

This does work.
Thank you.

Anonymous said...

Thanks! That worked like a charm!

I wish you also explained what these options mean..

Anonymous said...

OK.. i got it!

So -lfl tells the linker to link with the library: libfl.a or libfl.so which are Flex libraries under /usr/lib

:)

Anonymous said...

superb...thankyou

workingcaptchabypass said...

You could add this function instead and compile normally

yywrap()
{
}