#50 pngcrush 1.7.37 compilation error with mingw 3.20 gcc 4.7.0


Since there aren't any recent binaries available here I thought I'd try compiling pngcrush on my own. I'm using the latest version of mingw (3.20) which uses gcc 4.7.0. When I try to compile using the provided makefile, I get the following error:

In file included from adler32.c:8:0:
zutil.h:33:17: error: conflicting types for 'ptrdiff_t'
In file included from zconf.h:429:0,
from zlib.h:34,
from zutil.h:22,
from adler32.c:8:
c:\mingw\bin\../lib/gcc/mingw32/4.7.0/include/stddef.h:150:26: note: previous declaration of 'ptrdiff_t' was here
Makefile:66: recipe for target 'adler32.o' failed
mingw32-make: *** [adler32.o] Error 1

It looked like the problem was that zutil.h was trying to define ptrdiff_t when it had already been defined in stddef.h. I commented out the typedefs for ptrdiff_t in zutil.h and was able to compile successfully. The binary I generated seems to be working just fine. A better fix would probably be using #ifndef to check for the symbols that mingw and gcc use. I think they're


And boy howdy markdown is a pain to use, or maybe I'm just not used to it.

I'm not very familiar with git, otherwise I would have just made the change myself and skipped making this ticket. Maybe I should go learn git and do that.


  • Glenn Randers-Pehrson

    Forwarded to the zlib maintainers.

  • Glenn Randers-Pehrson

    • status: open --> accepted
    • milestone: -->
  • Glenn Randers-Pehrson

    • status: accepted --> closed
  • Glenn Randers-Pehrson

    Fixed the bundled zutil.c in pngcrush-1.7.42.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks