[Zlib-devel] Z_SOLO on MinGW (again)

Paul Marquess Paul.Marquess at ntlworld.com
Mon May 7 06:59:13 EDT 2012


Building 1.2.7 on Windows with MinGW (gcc 4.6.2) works fine out of the box,
but gives error this when Z_SOLO is defined.

 

$ make -f win32/Makefile.gcc

gcc  -O3 -Wall -DZ_SOLO -c -o adler32.o adler32.c

In file included from adler32.c:8:0:

zutil.h:33:17: error: conflicting types for 'ptrdiff_t'

c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/stddef.h:150:26: note:
previous declaration of 'ptrdiff_t' was here

make: *** [adler32.o] Error 1

 

 

The error is complaining about this section of code in zutil.h

 

#ifdef Z_SOLO 

   typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */

#endif

 

This is the line referenced in stddef,h 

 

typedef __PTRDIFF_TYPE__ ptrdiff_t;

 

A possible fix could then be

 

#if defined(Z_SOLO) && !defined(__PTRDIFF_TYPE__)

   typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */

#endif

 

 

There may be a better way to deal with the issue, but that change sorts it
out for my setup.

 

 

Paul

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20120507/361385cf/attachment.html>


More information about the Zlib-devel mailing list