Main Page | Report this Page
 
   
Science Forum Index  »  Compression Forum  »  problem with LZO: undefined reference to...
Page 1 of 1    
Author Message
Zanardi...
Posted: Tue May 13, 2008 5:57 am
Guest
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.cSad.text+0x19fc): undefined reference to `__lzo_init2'
collect2: ld returned 1 exit status


Someone can help me?
I thank you in advance,
Zanardi.
Zanardi...
Posted: Tue May 13, 2008 11:03 am
Guest
Quote:
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 Wink
Zanardi.
Phil Carmody...
Posted: Tue May 13, 2008 1:08 pm
Guest
Zanardi <gasperotti at (no spam) supereva.it> writes:
Quote:
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.cSad.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
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Wed Oct 15, 2008 8:40 pm