2
votes

I am using a external library of libharu-2.0.8, this is a open source pdf library. This lib have a lib file called libhpdf.lib and few header files

I have written a simple code to use this library. I am getting following errors.

libhpdf.lib(hpdf_streams.obj) : error LNK2001: unresolved external symbol _deflateEnd libhpdf.lib(hpdf_streams.obj) : error LNK2001: unresolved external symbol _deflate libhpdf.lib(hpdf_streams.obj) : error LNK2001: unresolved external symbol deflateInit

2

2 Answers

6
votes

They're calls to the zlib library functions, so you'll probably find that libhpdf has a dependency on that library.

In fact, if you go to http://libharu.sourceforge.net/, you'll see that you need both zlib and pnglib.

Quoting that page here:

In addition, ZLIB and PNGLIB are required when you want to use the features of compression and embedding PNG images. (In the case of Windows, static library files for several compilers are included in the package for WIndows. In the case of most of UNIX, these libraries are usually installed.)

1
votes

You could find the files: libpng.lib and zlib.lib already included in the package libharu_2_0_8_win32.zip in the directory:

libharu_2_0_8_win32\libharu-2.0.8\win32\msvc\

Simply add these files to your project and the errors disapear.