Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 02-21-2006, 03:00 AM   #1
LQ Newbie
Registered: Feb 2006
Posts: 5

Rep: Reputation: 0
problem while compiling a lex program

Hi friends,
I have the following lex program,

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,
Old 02-21-2006, 03:59 AM   #2
Senior Member
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
gtkglarea compiling program problem vas_dee Linux - Software 2 03-19-2005 05:23 AM
problem compiling kde and another program poboy975 Linux - Software 3 01-18-2005 12:41 AM
LEX failed during compiling GIMP, MDK 9.2 Ygarl Linux - Software 1 05-06-2004 08:05 PM
Problem with compiling my program. Zeth_htp Linux - Newbie 4 04-04-2003 10:12 PM
QT3 Problem when compiling a program PaladinCowboy75 Linux - Software 0 10-23-2002 09:53 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration