Forgot to say that I have manually changed LD_LIBRARY_PATH variable to
include the folder where several flex library files are installed. I have
not seen anything written about this in the documentation. But it does
seem to be the problem:
=========
$ echo $LD_LIBRARY_PATH
/media/local/lib
$ ls /media/local/lib
libfl.a libfl_pic.a libfl_pic.so libfl_pic.so.2.0.0 libfl.so.2
liby.a libfl.la libfl_pic.la libfl_pic.so.2 libfl.so
libfl.so.2.0.0
$ gcc -Wall lex.yy.c
fb1-1.l:xx: warning: control reaches end of non-void function
/tmp/ccydizSI.o: In function `yylex':
/.../lex.yy.c:846: undefined reference to `yywrap'
/tmp/ccydizSI.o: In function `input':
/.../lex.yy.c:1186: undefined reference to `yywrap'
collect2: ld returned 1 exit status
=========
-=-=-=-=-= I wrote: =-=-=-=-=-
> Package: flex
> Version: 2.6.0
>
> I downloaded, compiled and installed the latest flex, from source. No
problems showed.
>
> To start using it, I have the file fb1-1.l:
>
> =======
> /* wc */
> %{
> int chars = 0;
> int words = 0;
> int lines = 0;
> %}
> %%
> [a-zA-Z]+ { words++; chars += strlen(yytext); }
> \n { chars++; lines++; }
> { chars++; }
> %%
> main()
> {
> yylex();
> printf("lines words chars\n");
> printf("%8d %8d %8d\n", lines, words, chars);
> }
>
> =======
>
> I compile it, but it gives a few warnings in the generated lex.yy.c
file. The output from the terminal, including the commands I have used,
is:
>
> ==========
>
> $ flex fb1-1.l
>
> $ gcc -Wall lex.yy.c
>
> fb1-1.l:xx: warning: control reaches end of non-void function
> /tmp/ccydizSI.o: In function `yylex':
> /.../lex.yy.c:846: undefined reference to `yywrap'
> /tmp/ccydizSI.o: In function `input':
> /.../lex.yy.c:1186: undefined reference to `yywrap'
> collect2: ld returned 1 exit status
>
> ==========
>
> Shouldn't this work?
>
>
>