ZLIB linking problem


#1

After updating to the tip one of my libs can’t find ZLIB symbols anymore. I get these linker errors:

error LNK2019: unresolved external symbol _z_deflateEnd referenced in function …
error LNK2019: unresolved external symbol _z_deflate referenced in function …
error LNK2019: unresolved external symbol z_deflateInit referenced in function …

It used to be fine. Is there something I can do about this?


#2

They’re hidden away inside a namespace now, deliberately to avoid them causing link errors in projects that use their own copy of zlib. I guess you can still access them if you specify the same namespace - have a look through the source if you need to find its name.


#3

No, the older version also had the zlibNamespace already.

It seems the problem is the extern "C" lines in zlib.h and juce_GZIPDecompressorInputStream.cpp you have removed. As soon as I add them again it works.

My lib seems to need them, what can I do about this in the lib?


#4

The older version declared a namespace, but the extern “C” prevented it being applied to the symbols - that’s why Iremoved it. If you want to use the symbols, you’ll need to include and use the zlib headers in exactly the same way that I did it in the juce code, or just link to your own copy of zlib.