libPNG/libJPEG/zlib, linking problem (multiple definitions)

I’m linking the Juce library with another library (FreeImage) which comes with its own copy of libPNG, libJPEG and ZLib.
For this reason I get (in Microsoft Visual Studio 2008) the “already defined”/“multiple definitions” linking errors.

I know that juce_Config.h contains some options:


but in my case I prefer not to have “personal” copy of these libraries: for example I include FreeImage.h and link FreeImage.lib without having to deal with library versions. I was wondering if would be possible to add an option to “pack” Juce libPNG/libJPEG/zlib in a private “namespace”.
For example:

namespace pnglibNamespace {

//I want the symbols to be exported with namespace
//extern “C”

and modify the “pnglib/png.h”

#ifdef __cplusplus
extern “C” {


#ifdef __cplusplus

The same would work also for libJPG and zlib.

What version are you using? I changed this recently to improve the namespace isolation.

I was using the latest release from dowload page:

I’ve just done a git.
The "extern “C” has been commented for zlb / libpng.
For JPEG I see:

namespace jpeglibNamespace
typedef unsigned char boolean;
extern “C”

I suppose this extern “C” implies the standard C export of jpeg methods.

I changed the png and zlib to make sure all their symbols were entirely inside a private namespace… Maybe I didn’t do the same for jpeg… If not, I’ll take a look and see if it’s possible.