无法使用LibHaru,因为找不到zlib的引用

Cannot use LibHaru because cannot find the reference of zlib

本文关键字:找不到 zlib 引用 因为 LibHaru      更新时间:2023-10-16

我正在尝试构建一个程序,有望创建动态。pdf文件。我已经用PHP开发了一个类似的web项目,但现在我想用c++写它。

这导致我在过去的四天里重建了这三个库(zlib, libpng和libharu)超过三次。我已经阅读了网络上所有相关的条目(包括这个堆栈溢出条目),我知道我的问题是编译器找不到zlib(也许我理解错了问题)

我想解释我所做的事。请注意,我在Windows 7中使用Codeblocks IDE与GNU GCC c++编译器(MingGW)。首先,我编译了zlib 1.2.7并创建了我的zlib。静态库文件(我使用的是静态库)。其次,我编译了libpng 1.5.13,并创建了我的libpnga。第三,我编译了libharu(快照),创建了我的libharu。静态库文件。然后我将这些库文件添加到我的项目中。(我做了这里解释的所有事情)。最后,编译了我的项目。

好吧,我应该说所有的步骤我做了十多次,改变了一些小的东西,但每次我都得到一个错误。我甚至试过libharu.org上的官方例子。最奇怪的是,我的错误是不稳定的。几乎每次我都有不同的错误!但主要是与hpdf_streams.c有关。
我最近的日志文件:

C:Libslibharu-201301131604libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xd4a): undefined reference to `deflateInit_'
C:Libslibharu-201301131604libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xdfa): undefined reference to `deflate'
C:Libslibharu-201301131604libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xe78): undefined reference to `deflateEnd'
C:Libslibharu-201301131604libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xee2): undefined reference to `deflate'
C:Libslibharu-201301131604libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xf7e): undefined reference to `deflateEnd'
C:Libslibharu-201301131604libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xfb7): undefined reference to `deflateEnd'
C:Libslibharu-201301131604libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xff1): undefined reference to `deflateEnd'

我们刚刚遇到了这个问题。你需要重新编译zlib,关闭WIN_API。或者使用dll而不是静态库。