nomain problems
"Rahul Garg" <[email protected]> Sun, 11 Jun 2006 14:18:49 +0530
| Newsgroups | gmane.comp.lex.flex.general |
|---|---|
| Message-ID | <[email protected]> |
--===============1025426249==
Content-Type: multipart/alternative;
boundary="----=_Part_43346_25715876.1150015729429"
------=_Part_43346_25715876.1150015729429
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
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;
}
------=_Part_43346_25715876.1150015729429
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi.<br>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).<br>then i issued the following commands :<br>flex lex.l<br>gcc -lfl
lex.yy.c<br>however the linker produced the error :<br><br>/tmp/ccodQ1yE.o: In function `main':lex.yy.c:(.text+0xfb3): multiple definition of `main'<br>/usr/lib/gcc/i386-redhat-linux/4.1.0/../../../libfl.a(libmain.o): first defined here
<br>/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<br>collect2: ld returned 1 exit status<br><br>can someone please point out my error?
<br>sincerely,<br>rahul garg<br><br>the input file lex.l is :<br><br>%option nomain noyywrap<br>delim [ \t\n]<br>ws {delim}+<br>letter [a-zA-Z]<br>digit [0-9]<br>id {letter}({letter}|{digit})*<br>number {digit}+(\.{digit}+)?(E[+-]?{digit}+)?
<br><br>%%<br><br>{ws} {}<br>if|then|else|def {printf("keyword %s\n",yytext);}<br>{id} {printf("identifier %s\n",yytext);}<br>{number} {printf("number %s\n",yytext);}<br><br>%%<br><br>int main(int argc,char** argv){
<br>int count = 100;<br>while(count>0){<br> yylex();<br> count--;<br>}<br>return 0;<br>}<br><br><br><br><br><br><br>
------=_Part_43346_25715876.1150015729429--
--===============1025426249==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
help-flex mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-flex
--===============1025426249==--