[Zlib-devel] zlib gzopen_w function added

Theo Niessink theo at taletn.com
Sun Mar 18 08:05:36 EDT 2012


I have just fetched the develop branch from Git hub (up to commit 
a1af6e96e3), but now I can't build anymore using both Microsoft  C/C++ 
Compiler v15.0 and v16.0:

C:\zlib>nmake /f win32\Makefile.msc test

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl -c -I. -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -nologo
 -MD -W3 -O2 -Oy- -Zi -Fd"zlib"  test\example.c
example.c
C:\zlib\zlib.h(1737) : error C2143: syntax error : missing ')' before '*'
C:\zlib\zlib.h(1737) : error C2143: syntax error : missing '{' before '*'
C:\zlib\zlib.h(1737) : error C2059: syntax error : 'type'
C:\zlib\zlib.h(1737) : error C2059: syntax error : ')'
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 
9.0\VC\Bin
\cl.EXE"' : return code '0x2'
Stop.

This is because stddef.h isn't included in zlib.h, so I propose this simple 
patch:

---
 zlib.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/zlib.h b/zlib.h
index 901339c..69fd5ca 100644
--- a/zlib.h
+++ b/zlib.h
@@ -33,6 +33,10 @@

 #include "zconf.h"

+#ifdef _WIN32
+#  include <stddef.h>
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
-- 





More information about the Zlib-devel mailing list