How to compile and execute lex,yac,c and java programs

its the 3rd day on my New MacBook pro..

as i just migrated from windows to mac i love to work on this..


The main problem is i DON't know .......


how to compile and execute

1) lex and yac programs

2) c program

3) java program


so please help me

THIS is the error i got a1.l is a program


i got the same error when i used gcc



$ lex a1.l

$ cc lex.yy.c

Undefined symbols:

"_yywrap", referenced from:

_yylex in cc8QDQjW.o

_input in cc8QDQjW.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

MacBook Pro, Mac OS X (10.6.6)

Posted on Jun 2, 2011 11:43 PM

Reply
2 replies

Jun 3, 2011 8:59 AM in response to akarshsm

Is the problem that you don't know how to compile and execute these programs on a Mac, or just that you don't know how to compile and execute them?


Mac OS X is really just a version of BSD Unix, as far as programs like like bison, flex and gcc are concerned...and even when Apple specific versions are provided in the Developer Tools, there are symlinks in the usual places in the Unix file hierarchy.


For problems with lex and yacc, I suggest you start with their own references, for example, here.


Or you could just use %option noyywrap, if you only have one file to scan.


Or you could link to libfl.a using -lfl and use the default version from that library.


But you really should (as Keith Barkley was subtly hinting at) learn how these tools work and why they work that way.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to compile and execute lex,yac,c and java programs

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.