help-flex
[Top][All Lists]
Advanced

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

RE: nomain problems


From: Thurn, Martin
Subject: RE: nomain problems
Date: Mon, 12 Jun 2006 08:05:12 -0400

Try compiling it WITHOUT -lfl
 
P.S. Please send ONLY PLAIN TEXT email to mailing lists.
 
 - - Martin


________________________________

        From: address@hidden
[mailto:address@hidden On Behalf Of
Rahul Garg
        Sent: Sunday, June 11, 2006 04:49
        To: address@hidden
        Subject: nomain problems
        
        
        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]