Message-Id: <3.0.1.32.20010117133251.006b08c8@wingate> X-Sender: n_abing#ns DOT roxas-online DOT net DOT ph AT wingate X-Mailer: Windows Eudora Pro Version 3.0.1 (32) Date: Wed, 17 Jan 2001 13:32:51 +0800 To: djgpp AT delorie DOT com From: "Nimrod A. Abing" Subject: Re: undefined reference to `yyerror' Cc: xavier DOT robitaille AT videotron DOT ca In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk At 11:38 PM 01/16/2001 -0500, you wrote: >I am able to generate "compile" the .y and .l, but I am unable to build my >application. >The command I use to build it is > >gcc -o ch3-01 ch3-01.tab.c lexyy.c -lfl > >and I get a linker : undefined reference to `yyerror' You may have forgotten to include the yyerror function in your C declarations and definitions section of the parser. %{ /* ... your C decls/defns here ... */ /* snipped from bison.info docs */ int yyerror(char *s) { printf("%s\n", s); } %} /* ... bison decls here ... */ %% /* ... bison rules ... */ %% /* ... more C code; in most cases, main() is defined here ... */ This yyerror function does nothing more than print out the error message generated by the parser. You can do more in the yyerror function if you wish. "This is left as an exercise for the reader." ;-)