This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

error in gcc command exectuion


 

 
Hello,
 
i am new to cygwin and compiler writing.
I am actually only using bison, flex and gcc from this pacakge.
 
i am getting below error when runing gcc command:
/cygdrive/c/temp/ccG2W75I.o:example6.c:(.text+0x206): undefined
reference to `_yylval'
 
i am runing a very simple example from intenet only:
below are the input files
 
flex file:
%{
#include <stdio.h>
#include "example6.tab.h"
extern YYSTYPE yylval;
%}
 
%%
 
zone   return ZONETOK;
file   return FILETOK;
[a-zA-Z][a-zA-Z0-9]*    yylval=strdup(yytext); return WORD;
[a-zA-Z0-9\/.-]+        yylval=strdup(yytext); return FILENAME;
\"                      return QUOTE;
\{                      return OBRACE;
\}                      return EBRACE;
;                       return SEMICOLON;
\n                      /* ignore EOL */;
[ \t]+                  /* ignore whitespace */;
%% 
 
bison file:
 
%{
#include <stdio.h>
#include <string.h>
 
#define YYSTYPE char *
 
int yydebug=0;
 
void yyerror(const char *str)
{
 fprintf(stderr,"error: %s\n",str);
}
 
int yywrap()
{
 return 1;
}
 
main()
{
 yyparse();
}
 
%}
 
%token WORD FILENAME QUOTE OBRACE EBRACE SEMICOLON ZONETOK FILETOK
 
%%
 
commands:
 |  
 commands command SEMICOLON
 ;
 

command:
 zone_set 
 ;
 
zone_set:
 ZONETOK quotedname zonecontent
 {
  printf("Complete zone for '%s' found\n",$2);
 }
 ;
 
zonecontent:
 OBRACE zonestatements EBRACE 
 
quotedname:
 QUOTE FILENAME QUOTE
 {
  $$=$2;
 }
 ;
 
zonestatements:
 |
 zonestatements zonestatement SEMICOLON
 ;
 
zonestatement:
 statements
 |
 FILETOK quotedname 
 {
  printf("A zonefile name '%s' was encountered\n", $2);
 }
 ;
 
block: 
 OBRACE zonestatements EBRACE SEMICOLON
 ;
 
statements:
 | statements statement
 ;
 
statement: WORD | block | quotedname 
 
 
the execution commands i use are :
 
bison -d D:\rave2\rtt\parsers\bison_flex\run_example\example6.y
flex -oD:\example6.c D:\example6.l
 
gcc D:\example6.c -oD:\example6.exe -lfl

and then i get error:
/cygdrive/c/temp/ccG2W75I.o:example6.c:(.text+0x206): undefined
reference to `_yylval'
			collect2: ld returned 1 exit status
 
i am using Windows XP .
 
can anyone please help in getting read of this error.
 
Best Regards,
Rameshwari

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]