[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem linking program containing bison-generated parser
From: |
Volker Wegert |
Subject: |
problem linking program containing bison-generated parser |
Date: |
Thu, 10 Mar 2005 22:25:53 +0100 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
Hello,
I'm currently trying to gain some experience with flex and bison. In one of my
projects, I'd like to use these two tools together with some Qt classes. I'm
not trying to create an object-oriented parser, I'm just using Qt's string and
list objects as I'm much more familiar with them. The idea is to feed an input
file through a bison-generated parser and create an object structure that is
processed subsequently.
However, I get the following error message during linking (output
abbreviated):
,----
| ..
| bison -y -d -t -v CDLparse.y
| ...
| if test -f y.tab.h; then \
| to=`echo "CDLparse_H" | sed \
| -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
\
| -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \
| sed -e "/^#/!b" -e "s/Y_TAB_H/$to/g" -e "s|y\.tab\.h|CDLparse.h|" \
| y.tab.h >CDLparse.ht; \
| rm -f y.tab.h; \
| if cmp -s CDLparse.ht CDLparse.h; then \
| rm -f CDLparse.ht ;\
| else \
| mv CDLparse.ht CDLparse.h; \
| fi; \
| fi
| if test -f y.output; then \
| mv y.output CDLparse.output; \
| fi
| sed '/^#/ s|y\.tab\.c|CDLparse.c|' y.tab.c >CDLparse.ct && mv CDLparse.ct
| CDLparse.c
| rm -f y.tab.c
| ...
| flex -d -s -B CDLlex.l
| ...
| sed '/^#/ s|lex.yy\.c|CDLlex.c|' lex.yy.c >CDLlex.c
| rm -f lex.yy.c
| if gcc -DHAVE_CONFIG_H -I. -I. -I. -DYY_NO_UNISTD_H -g -O2 -MT
| quickconfig-CDLlex.o -MD -MP -MF ".deps/quickconfig-CDLlex.Tpo" -c -o
| quickconfig-CDLlex.o `test -f 'CDLlex.c' || echo './'`CDLlex.c; \
| then mv -f ".deps/quickconfig-CDLlex.Tpo" ".deps/quickconfig-CDLlex.Po";
| else rm -f ".deps/quickconfig-CDLlex.Tpo"; exit 1; fi
| ...
| if gcc -DHAVE_CONFIG_H -I. -I. -I. -DYY_NO_UNISTD_H -g -O2 -MT
| quickconfig-CDLparse.o -MD -MP -MF ".deps/quickconfig-CDLparse.Tpo" -c -o
| quickconfig-CDLparse.o `test -f 'CDLparse.c' || echo './'`CDLparse.c; \
| then mv -f ".deps/quickconfig-CDLparse.Tpo" ".deps/quickconfig-CDLparse.Po";
| else rm -f ".deps/quickconfig-CDLparse.Tpo"; exit 1; fi
| g++ -g -O2 -o quickconfig quickconfig-quickconfig.o
| quickconfig-QCGenerator.o quickconfig-CDLlex.o quickconfig-CDLparse.o
| quickconfig-GetOpt.o -lm -lfl -L/usr/qt/3/lib -lqt -L -lXext -lX11 -lm -lSM
| -lICE -ldl -ljpeg
| quickconfig-QCGenerator.o(.text+0xfab): In function
`QCGenerator::parseInputFile()':
| /home/vwegert/Entwicklung/Linux/Qt/QuickConf/cvs/src/QCGenerator.cpp:145:
| undefined reference to `yyparse()'
| collect2: ld returned 1 exit status
`----
However, readelf -s quickconfig-CDLparse.o returns
,----
| Symbol table '.symtab' contains 51 entries:
| Num: Value Size Type Bind Vis Ndx Name
| 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
| 1: 00000000 0 FILE LOCAL DEFAULT ABS CDLparse.c
| 2: 00000000 0 SECTION LOCAL DEFAULT 1
| 3: 00000000 0 SECTION LOCAL DEFAULT 3
| 4: 00000000 0 SECTION LOCAL DEFAULT 4
| 5: 00000000 0 SECTION LOCAL DEFAULT 5
| 6: 00000000 0 SECTION LOCAL DEFAULT 6
| 7: 00000000 0 SECTION LOCAL DEFAULT 8
| 8: 00000000 0 SECTION LOCAL DEFAULT 10
| 9: 00000000 303 OBJECT LOCAL DEFAULT 10 yytranslate
| 10: 00000140 70 OBJECT LOCAL DEFAULT 10 yyprhs
| 11: 000001a0 190 OBJECT LOCAL DEFAULT 10 yyrhs
| 12: 00000260 70 OBJECT LOCAL DEFAULT 10 yyrline
| 13: 00000000 0 SECTION LOCAL DEFAULT 12
| 14: 000002c0 368 OBJECT LOCAL DEFAULT 10 yytname
| 15: 00000440 70 OBJECT LOCAL DEFAULT 10 yyr1
| 16: 000004a0 70 OBJECT LOCAL DEFAULT 10 yyr2
| 17: 00000500 113 OBJECT LOCAL DEFAULT 10 yydefact
| 18: 00000580 43 OBJECT LOCAL DEFAULT 10 yydefgoto
| 19: 000005c0 113 OBJECT LOCAL DEFAULT 10 yypact
| 20: 00000640 43 OBJECT LOCAL DEFAULT 10 yypgoto
| 21: 00000680 97 OBJECT LOCAL DEFAULT 10 yytable
| 22: 00000700 97 OBJECT LOCAL DEFAULT 10 yycheck
| 23: 00000780 113 OBJECT LOCAL DEFAULT 10 yystos
| 24: 00000000 121 FUNC LOCAL DEFAULT 1 yy_stack_print
| 25: 00000000 0 SECTION LOCAL DEFAULT 13
| 26: 00000080 175 FUNC LOCAL DEFAULT 1 yy_reduce_print
| 27: 00000130 87 FUNC LOCAL DEFAULT 1 yysymprint
| 28: 00000190 5 FUNC LOCAL DEFAULT 1 yydestruct
| 29: 00000000 0 SECTION LOCAL DEFAULT 14
| 30: 00000000 0 SECTION LOCAL DEFAULT 16
| 31: 00000000 0 SECTION LOCAL DEFAULT 18
| 32: 00000000 0 SECTION LOCAL DEFAULT 20
| 33: 00000000 0 SECTION LOCAL DEFAULT 21
| 34: 00000000 0 SECTION LOCAL DEFAULT 22
| 35: 00000000 0 SECTION LOCAL DEFAULT 23
| 36: 00000000 0 NOTYPE GLOBAL DEFAULT UND stderr
| 37: 00000000 0 NOTYPE GLOBAL DEFAULT UND fwrite
| 38: 00000000 0 NOTYPE GLOBAL DEFAULT UND fputc
| 39: 00000000 0 NOTYPE GLOBAL DEFAULT UND fprintf
| 40: 000001a0 2092 FUNC GLOBAL DEFAULT 1 yyparse
| 41: 00000004 4 OBJECT GLOBAL DEFAULT COM yydebug
| 42: 00000004 4 OBJECT GLOBAL DEFAULT COM yynerrs
| 43: 00000004 4 OBJECT GLOBAL DEFAULT COM yychar
| 44: 00000000 0 NOTYPE GLOBAL DEFAULT UND memcpy
| 45: 00000000 0 NOTYPE GLOBAL DEFAULT UND identifier
| 46: 00000000 0 NOTYPE GLOBAL DEFAULT UND printf
| 47: 00000000 0 NOTYPE GLOBAL DEFAULT UND puts
| 48: 00000004 4 OBJECT GLOBAL DEFAULT COM yylval
| 49: 00000000 0 NOTYPE GLOBAL DEFAULT UND yyerror
| 50: 00000000 0 NOTYPE GLOBAL DEFAULT UND yylex
`----
So as far as I can see, the function yylex() should be present. Can anybody
tell me what's going wrong here?
Thanks in advance
Volker
--
* Volker Wegert * http://www.volker-wegert.de/contact *
* "Menschen und Völker handeln erst dann vernünftig, wenn alle anderen
* Möglichkeiten erschöpft sind." (Abba Solomon Eban)
*
- problem linking program containing bison-generated parser,
Volker Wegert <=
Re: problem linking program containing bison-generated parser, Laurence Finston, 2005/03/11