Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Deflate And Inflate With zLib

I'm trying to compile the zpipe.c example in my Linux(Ubuntu 8.04) with gcc, but I'm getting some errors, take a look:

[ubuntu@eeepc:~/Desktop] gcc zpipe.c /tmp/ccczEQxz.o: In function `def': zpipe.c:(.text+0x65): undefined reference to `deflateInit_' zpipe.c:(.text+0xd3): undefined reference to `deflateEnd' zpipe.c:(.text+0x150): undefined reference to `deflate' zpipe.c:(.text+0x1e8): undefined reference to `deflateEnd' zpipe.c:(.text+0x27b): undefined reference to `deflateEnd' /tmp/ccczEQxz.o: In function `inf': zpipe.c:(.text+0x314): undefined reference to `inflateInit_' zpipe.c:(.text+0x382): undefined reference to `inflateEnd' zpipe.c:(.text+0x3d7): undefined reference to `inflate' zpipe.c:(.text+0x44b): undefined reference to `inflateEnd' zpipe.c:(.text+0x4c1): undefined reference to `inflateEnd' zpipe.c:(.text+0x4f6): undefined reference to `inflateEnd' collect2: ld returned 1 exit status [ubuntu@eeepc:~/Desktop] 

Remember that I've installed zLib-dev correctly, but why i'm getting this errors?

like image 795
Nathan Campos Avatar asked Oct 27 '09 16:10

Nathan Campos


People also ask

What is zlib deflate?

zlib (/ˈziːlɪb/ or "zeta-lib", /ˈziːtəˌlɪb/) is a software library used for data compression. zlib was written by Jean-loup Gailly and Mark Adler and is an abstraction of the DEFLATE compression algorithm used in their gzip file compression program.

What is zlib inflate?

The zlib. inflate() method is an inbuilt application programming interface of the Zlib module which is used to decompress a chunk of data. Syntax: zlib.inflate( buffer, options, callback )

What is zlib compression level?

The compression ratio of zlib ranges between 2:1 to 5:1. Additionally, it provides ten compression levels, and different levels have different compression ratios and speeds. zlib algorithm uses Deflate method for compression and Inflate method for decompression. Deflate method encodes the data into compressed data.

What is zlib stream?

zlib stream mode ? level? This command, part of zlib, creates a streaming compression or decompression command, allowing greater control over the compression/decompression process. It returns the name of the stream instance command. The mode must be one of compress, decompress, deflate, inflate, gzip, gunzip.


1 Answers

You need to link it with the zlib library as well. Just add -lz to near end of your command line.

like image 83
György Andrasek Avatar answered Sep 26 '22 12:09

György Andrasek