LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   problem while compiling a lex program (https://www.linuxquestions.org/questions/linux-software-2/problem-while-compiling-a-lex-program-417872/)

sam_cit 02-21-2006 03:00 AM

problem while compiling a lex program
 
Hi friends,
I have the following lex program,
%%
. ECHO;
%%

i executed the following commands,
lex sample.l
and then tried to compile the generated c file,

cc lex.yy.c

and i get these errors, kindly help me,

/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/../../../crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
/tmp/ccqyGJRm.o(.text+0x312): In function `yylex':
: undefined reference to `yywrap'
/tmp/ccqyGJRm.o(.text+0xa54): In function `input':
: undefined reference to `yywrap'
collect2: ld returned 1 exit status

Kindly help me as soon as possible.

Thanks And Regards,
Vairavan.S

timmeke 02-21-2006 03:59 AM

Quote:

collect2: ld returned 1 exit status
Says that the error messages come from "ld", the linker.
Most likely, you've forgot to include some libraries needed to compile the lex code.
When a library is missing, functioncalls to functions from the library can give you "undefined reference" errors.

I'm not sure which you need exactly, so I'd recommend to search around for tutorials and stuff.


All times are GMT -5. The time now is 08:16 AM.