The library to use with flex is libfl.a. On my RH 5.1 install, it was
placed in /usr/lib/libfl.a. Use -lfl (rather than -ll) to link against it.
I haven't used flex/bison for a while, but I'm not aware of any libraries
that you need to link against when using bison (yacc). I didn't see any
libraries mentioned in the texinfo for bison, nor did I see any yacc-related
libraries mentioned in the O'Reilly title "lex & yacc".
Thanks,
Andrew
On Sun, 1 Nov 1998, Andrew Todd Brown wrote:
>
> Gordon B. Weir wrote in message ...
> >I am currently taking a 'compiler' computer science course and I have been
> >using lex and yacc on a Unix platform. I just installed Redhat Linux on my
> >PC so that I would be able to work at home. Everything seems to be working
> >fine, except when I try to specify the flex and yacc libraries and get the
> >error message "unknown library."
>
> I haven't used flex/bison for a while, but I'm not aware of any libraries
> that you need to link against when using bison (yacc). I didn't see any
> libraries mentioned in the texinfo for bison, nor did I see any yacc-related
> libraries mentioned in the O'Reilly title "lex & yacc".
to link a yacc/bison output correctly, you shall have another *.c file in
which you'll write the main() and yyerror() functions. that's all.
your main() may simply call yyparse() without any arguments and your
yyerror(char*) may simply print the message to stderr.hope this helps:)
> I am currently taking a 'compiler' computer science course and I have been
> using lex and yacc on a Unix platform. I just installed Redhat Linux on my
> PC so that I would be able to work at home. Everything seems to be working
> fine, except when I try to specify the flex and yacc libraries and get the
> error message "unknown library." On the unix network I used 'gcc -c -ly
> y.tab.c' and 'gcc -c -ll lex.yy.c. I suppose that either I am not using the
> correct names or I need to specify their locations in the proper path. Can
> anyone help me?
I too ran into the same issue in my CS class. I found the lex (GNU flex)
library libfl.a, but found the yacc (byacc, bison) liby.a boldly missing, thus
"gcc yy.tab.c -ly -lfl" would report an error for the missing yacc library. I
worked around the problem by incorporating the source for "yyerror" and "main"
calling yyparse in my yacc code. Since then, I have found the source for
liby.a off a minix site (http://virtual.scs.wsu.edu/minix/src/lib/liby) but
haven't been able to link it to build my own liby.a. See
http://virtual.scs.wsu.edu/minix/src/lib/liby/main.c and
http://virtual.scs.wsu.edu/minix/src/lib/liby/yyerror.c. I was going to include
the source code but then saw the licensing statement and decided to cover my
butt. As you can see it's not too complex, which is probably why they don't
include the library any more, although it is on my Solaris box.
--
Comments reflected here do not in anyway represent The Boeing Company!
Scott Leathley
sco...@sun-aw18.ds.boeing.com || scott.w....@boeing.com
"Computers may be stupid, but they're always obedient. Well, almost always." -
Larry Wall
>Gordon B. Weir wrote:
>> I am currently taking a 'compiler' computer science course and I have been
>> using lex and yacc on a Unix platform. I just installed Redhat Linux on my
>> PC so that I would be able to work at home. Everything seems to be working
>> fine, except when I try to specify the flex and yacc libraries and get the
>> error message "unknown library." On the unix network I used 'gcc -c -ly
>> y.tab.c' and 'gcc -c -ll lex.yy.c. I suppose that either I am not using the
>> correct names or I need to specify their locations in the proper path. Can
>> anyone help me?
Just use bison, not the yacc script, directly, it doesn't need a library.
Just leave the -ly out.
HTH,
Uli
--
Dipl. Inf. Ulrich Teichert|e-mail: Ulrich....@gmx.de
Stormweg 24 |listening to: This Is Just A Punk Rock Song (Bad
24539 Neumuenster, Germany|Religion), Shadow (The Headcoatees)