0

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

这导致我在过去四天中多次重建这三个库(zlib、libpng 和 libharu)。我已经阅读了网络上的所有相关条目(包括这个堆栈溢出条目)我明白我的问题是编译器找不到 zlib(可能我理解错误)

我想解释一下我做了什么。请注意,我在 Windows 7 中使用带有 GNU GCC C++ 编译器 (MingGW) 的 Codeblocks IDE。首先,我编译了 zlib 1.2.7 并创建了我的 zlib.a 静态库文件(我正在使用静态库)。其次,我编译了 libpng 1.5.13 并创建了我的 libpng.a。第三,我编译了 libharu(快照)并创建了我的 libharu.a 静态库文件。然后我将这些库文件添加到我的项目中。(我做了这里解释的一切)。最后,编译了我的项目。

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

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

1 回答 1

0

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

于 2013-02-06T19:49:20.790 回答