RE: nomain problems
"Thurn, Martin" <[email protected]> Mon, 12 Jun 2006 08:05:12 -0400
| Newsgroups | gmane.comp.lex.flex.general |
|---|---|
| Message-ID | <[email protected]> |
Try compiling it WITHOUT -lfl =20 P.S. Please send ONLY PLAIN TEXT email to mailing lists. =20 - - Martin ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Rahul Garg Sent: Sunday, June 11, 2006 04:49 To: [email protected] Subject: nomain problems =09 =09 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 : =09 /tmp/ccodQ1yE.o: In function `main':lex.yy.c:(.text+0xfb3): multiple definition of `main' =09 /usr/lib/gcc/i386-redhat-linux/4.1.0/../../../libfl.a(libmain.o): first defined here=20 /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 =09 can someone please point out my error?=20 sincerely, rahul garg =09 the input file lex.l is : =09 %option nomain noyywrap delim [ \t\n] ws {delim}+ letter [a-zA-Z] digit [0-9] id {letter}({letter}|{digit})* number {digit}+(\.{digit}+)?(E[+-]?{digit}+)?=20 =09 %% =09 {ws} {} if|then|else|def {printf("keyword %s\n",yytext);} {id} {printf("identifier %s\n",yytext);} {number} {printf("number %s\n",yytext);} =09 %% =09 int main(int argc,char** argv){=20 int count =3D 100; while(count>0){ yylex(); count--; } return 0; } =09 =09 =09 =09 =09 =09 =09