delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/08/06:37:32

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
MIME-Version: 1.0
Subject: error in gcc command exectuion
Date: Thu, 8 Sep 2005 16:06:25 +0530
Message-ID: <4847DBE579D78B4A9C610E2EA77B4634034BE489@inblrk999msx.in002.siemens.net>
From: "Vedpathak, Rameshwari IN BLR SISL" <Rameshwari DOT Vedpathak AT siemens DOT com>
To: <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j88AbTWR031919

 

 
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/


- Raw text -


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