www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/17/00:42:48

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" <n_abing AT ns DOT roxas-online DOT net DOT ph>
Subject: Re: undefined reference to `yyerror'
Cc: xavier DOT robitaille AT videotron DOT ca
In-Reply-To: <yf996.5864$pY3.197907@weber.videotron.net>
Mime-Version: 1.0
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

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." ;-)


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019