L'errore si sgonfia e si gonfia con zLib
-
06-07-2019 - |
Domanda
Sto cercando di compilare l'esempio zpipe.c nel mio Linux (Ubuntu 8.04) con gcc, ma sto ricevendo alcuni errori, dai un'occhiata:
[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]
Ricorda che ho installato zLib-dev correttamente, ma perché visualizzo questi errori?
Soluzione
Devi collegarlo anche alla libreria zlib. Aggiungi -lz alla fine della riga di comando.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow