【问题标题】:Error Deflate And Inflate With zLib使用 zLib 放气和充气时出错
【发布时间】:2010-12-10 13:43:53
【问题描述】:

我正在尝试使用 gcc 在我的 Linux(Ubuntu 8.04) 中编译 zpipe.c 示例,但出现了一些错误,请查看:

[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]

记得我已经正确安装了 zLib-dev,但是为什么会出现这个错误?

【问题讨论】:

    标签: c compression zlib


    【解决方案1】:

    您还需要将它与 zlib 库链接。只需将 -lz 添加到命令行的末尾即可。

    【讨论】:

    • 仅供参考...您必须将 -lz 放在末尾:gcc zlib_main.c -lz
    • @György Andrasek Нow 在操作系统 Windows 上执行此操作
    猜你喜欢
    • 1970-01-01
    • 2014-03-16
    • 2014-08-22
    • 1970-01-01
    • 1970-01-01
    • 2021-12-09
    • 2015-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多