help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nomain problems


From: Rahul Garg
Subject: nomain problems
Date: Sun, 11 Jun 2006 14:18:49 +0530

Hi.
I am a beginner with Flex. I am using flex-2.5.4a37.4 on fedora core 5. i prepared a file lex.l (the contents of which are copied at the end of the mail).
then i issued the following commands :
flex lex.l
gcc -lfl lex.yy.c
however the linker produced the error :

/tmp/ccodQ1yE.o: In function `main':lex.yy.c:(.text+0xfb3): multiple definition of `main'
/usr/lib/gcc/i386-redhat-linux/4.1.0/../../../libfl.a(libmain.o): first defined here
/usr/bin/ld: Warning: size of symbol `main' changed from 48 in /usr/lib/gcc/i386-redhat-linux/4.1.0/../../../libfl.a(libmain.o) to 55 in /tmp/ccodQ1yE.o
collect2: ld returned 1 exit status

can someone please point out my error?
sincerely,
rahul garg

the input file lex.l is :

%option nomain noyywrap
delim [ \t\n]
ws {delim}+
letter [a-zA-Z]
digit [0-9]
id {letter}({letter}|{digit})*
number {digit}+(\.{digit}+)?(E[+-]?{digit}+)?

%%

{ws} {}
if|then|else|def {printf("keyword %s\n",yytext);}
{id} {printf("identifier %s\n",yytext);}
{number} {printf("number %s\n",yytext);}

%%

int main(int argc,char** argv){
int count = 100;
while(count>0){
    yylex();
    count--;
}
return 0;
}







reply via email to

[Prev in Thread] Current Thread [Next in Thread]