Re: [Flex-help] Any example on how to use flex generated file?
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Peng Yu <pen...@gm...> - 2009-12-20 04:05:58
|
On Sat, Dec 19, 2009 at 9:42 PM, Marcel Laverdet <ma...@la...> wrote: > > > You'll probably want to use a compiler for that. I recommend gcc. I knew that I should use gcc to compile .c files. But I don't find the main() function in lex.yy.c. Here are the errors that I get. Should I have a .c file that has the main() function to compile with lex.yy.c? $gcc lex.yy.c Undefined symbols: "_yywrap", referenced from: _yylex in ccMsCrId.o _input in ccMsCrId.o "_main", referenced from: start in crt1.10.5.o ld: symbol(s) not found collect2: ld returned 1 exit status pengy@bcm-30-165:~/morgan/test/flex$gcc --version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > On Sat, 19 Dec 2009 20:49:10 -0600, Peng Yu <pen...@gm...> wrote: >> I try the following example to generate lex.yy.c file. But I'm not >> sure how to use it. Could somebody give me an example main file that >> can be used with lex.yy.c so that I can compile them to an executable? >> >> $cat test.yy >> %% >> username printf( "%s", getlogin() ); >> $flex test.yy >> $ls >> lex.yy.c test.yy >> >> > ------------------------------------------------------------------------------ >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's best-in-class app development support >> A streamlined, 14 day to market process makes app distribution fast and >> easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizon-dev2dev >> _______________________________________________ >> Flex-help mailing list >> Fle...@li... >> https://lists.sourceforge.net/lists/listinfo/flex-help > |