Am Sam, 2003-03-29 um 03.00 schrieb Hans-Georg Lerdo:
On Friday 28 March 2003 12:55, David Haller wrote:
gcc y.tab.c -ly -ll -o run
Also die flex-Lib heisst libfl, zu linken mit -lfl, eine liby kenne ich nicht. Yep, habe ich auch hier gefunden und wird auch beim compilieren erkannt. Aber...
Hier ist der Auszug meines "Compilierversuchs":
hg@Thinkpad:~/Documents/University/COP 6726/project/current> gcc lex.yy.o y.tab.c -lfl -o run lex.yy.o: In function `yylex': lex.yy.o(.text+0x46e): undefined reference to `yyerror' /tmp/ccH1E2Uo.o: In function `yyparse': /tmp/ccH1E2Uo.o(.text+0x189): undefined reference to `yyerror' /tmp/ccH1E2Uo.o(.text+0x3d1): undefined reference to `yyerror' collect2: ld returned 1 exit status hg@Thinkpad:~/Documents/University/COP 6726/project/current>
Wenn ich DIESELBEN lex/yacc Dateien auf den Solaris System meiner Uni compilere (mit: "gcc lex.yy.o -ll -ly y.tab.c -o run"), geht das wunderbar und das Program laeuft auch richtig.
bison != yacc, flex != lex, Solaris != Linux Der Knackpunkt dürfte in deinem Fall bison vs. yacc sein, da Du unter Solaris entweder yacc und nicht bison verwendest, oder aber bison generierten Code mit Solaris/yacc's liby linkst. Aus info bison (Stichwort yyerror): The Bison parser expects to report the error by calling an error reporting function named `yyerror', which you must supply. It is called by `yyparse' whenever a syntax error is found, and it receives one argument. For a parse error, the string is normally `"parse error"'. [liby unter Solaris enthält im wesentlichen nur yyerror.]
Also nehme ich mal an, das die Files ok sind und nur die "compiliererei" hier hakt. Willkommen in der Welt der portablen Programmierung ;)
Irgendeine Idee??
Implementier yyerror innerhalb der *.y-Datei und vergiss liby. Ralf