Error Deflate And Inflate With zLib
Asked Answered
A

1

35

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?

Adorno answered 27/10, 2009 at 16:51 Comment(0)
U
60

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

Unifilar answered 27/10, 2009 at 16:53 Comment(2)
FYI... you have to place the -lz at the end: gcc zlib_main.c -lzMade
@György Andrasek Нow to do it on the OS WindowsCinthiacintron

© 2022 - 2024 — McMap. All rights reserved.