Unable to compile output of lex

Posted by dbarker on Stack Overflow See other posts from Stack Overflow or by dbarker
Published on 2010-04-10T05:40:04Z Indexed on 2010/04/10 5:43 UTC
Read the original article Hit count: 394

Filed under:
|
|

When I attempt to compile the output of this trivial lex program:

# lex.l
integer   printf("found keyword INT");

using:

$ gcc lex.yy.c

I get:

Undefined symbols:
  "_yywrap", referenced from:
      _yylex in ccMsRtp7.o
      _input in ccMsRtp7.o
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

lex --version tells me I'm actually using 'flex 2.5.35' although ls -fla `which lex` isn't a symlink. Any ideas why the output won't compile?

© Stack Overflow or respective owner

Related posts about lex

Related posts about lexer