Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem with LZO: undefined reference to '__lzo_init2'

174 views
Skip to first unread message

Zanardi

unread,
May 13, 2008, 11:57:33 AM5/13/08
to
Hi,

I need help with LZO. I write a programm in C, with Linux (debian) and
I need to use LZO for compress my data.

I install LZO and in my code I add:

#include <lzoconf.h>
#include <lzo1x.h>

and in my 'main':

lzo_init();

The answer, when I compiling is:

gcc MyProgram.c -o MyProgram
/tmp/cc2Lx3eX.o: In function `main':
MyProgram.c:(.text+0x19fc): undefined reference to `__lzo_init2'
collect2: ld returned 1 exit status


Someone can help me?
I thank you in advance,
Zanardi.

Phil Carmody

unread,
May 13, 2008, 2:08:41 PM5/13/08
to
Zanardi <gaspe...@supereva.it> writes:
> Hi,
>
> I need help with LZO. I write a programm in C, with Linux (debian) and
> I need to use LZO for compress my data.
>
> I install LZO and in my code I add:
>
> #include <lzoconf.h>
> #include <lzo1x.h>
>
> and in my 'main':
>
> lzo_init();
>
> The answer, when I compiling is:
>
> gcc MyProgram.c -o MyProgram
> /tmp/cc2Lx3eX.o: In function `main':
> MyProgram.c:(.text+0x19fc): undefined reference to `__lzo_init2'
> collect2: ld returned 1 exit status

You need to link with the lzo library.
It's probably a file called /usr/lib/liblzo.a
In which case change your your command line to

gcc MyProgram.c -o MyProgram -llzo

(so -l followed by the library name without the path,
the 'lib' bit, or the extension.)

Phil
--
Dear aunt, let's set so double the killer delete select all.
-- Microsoft voice recognition live demonstration

Zanardi

unread,
May 13, 2008, 5:03:32 PM5/13/08
to
> You need to link with the lzo library.
> It's probably a file called /usr/lib/liblzo.a
> In which case change your your command line to
>
> gcc MyProgram.c -o MyProgram -llzo
>
> (so -l followed by the library name without the path,
> the 'lib' bit, or the extension.)


You're right, with:

gcc MyProgram.c -o MyProgram -llzo2

It works perfectly ;-)

Thank you ;-)
Zanardi.

0 new messages