ukblacknight
July 20th, 2010, 03:03 PM
I'm trying to run an example that's in the book "Flex & Bison". I've written out my own examples, and also downloaded the examples available from the o'reily FTP site, both of which won't run.
The relevant files are (remove the .txt extension):
fb3-1.l
fb3-1.y
fb3-1.h
fb3-1funcs.c
To build, you run:
bison -d fb3-1.y
flex -ofb3-1.lex.c fb3-1.l
cc -o $@ fb3-1.tab.c fb3-1.lex.c fb3-1funcs.c
Which is giving me the following error:
/tmp/ccNoe5BR.o: In function `yylex':
fb3-1.lex.c:(.text+0x2d5): undefined reference to `yylval'
/tmp/ccPI4ubH.o: In function `main':
fb3-1funcs.c:(.text+0x420): undefined reference to `yyparse'
collect2: ld returned 1 exit status
I've got flex-old and bison installed, so I can't figure this one out :\ I've also tried using the 'flex' package rather than 'flex-old', but that doesn't seem to make a difference.
Anyone got any ideas?
The relevant files are (remove the .txt extension):
fb3-1.l
fb3-1.y
fb3-1.h
fb3-1funcs.c
To build, you run:
bison -d fb3-1.y
flex -ofb3-1.lex.c fb3-1.l
cc -o $@ fb3-1.tab.c fb3-1.lex.c fb3-1funcs.c
Which is giving me the following error:
/tmp/ccNoe5BR.o: In function `yylex':
fb3-1.lex.c:(.text+0x2d5): undefined reference to `yylval'
/tmp/ccPI4ubH.o: In function `main':
fb3-1funcs.c:(.text+0x420): undefined reference to `yyparse'
collect2: ld returned 1 exit status
I've got flex-old and bison installed, so I can't figure this one out :\ I've also tried using the 'flex' package rather than 'flex-old', but that doesn't seem to make a difference.
Anyone got any ideas?