title: Redefinition of z_stream_s, gz_header_s, gzfile_s in zlib.h for objective c after upgrade to xcode13
body: <p>After upgrade to xcode13.4, redefinition of struct  z_stream_s, gz_header_s, gzfile_s in zlib.h.</p>
  <p>I added to guard to avoid the redefinition in the starting and ending</p>
  <pre><code>#ifndef ZLIB_H
  #define ZLIB_H
  
  ------ coding
  
  #endif
  </code></pre>
  <p>Code where the error occurring</p>
  <pre><code>typedef struct z_stream_s {
      z_const Bytef *next_in;     /* next input byte */
      uInt     avail_in;  /* number of bytes available at next_in */
      uLong    total_in;  /* total number of input bytes read so far */
  
      Bytef    *next_out; /* next output byte will go here */
      uInt     avail_out; /* remaining free space at next_out */
      uLong    total_out; /* total number of bytes output so far */
  
      z_const char *msg;  /* last error message, NULL if no error */
      struct internal_state FAR *state; /* not visible by applications */
  
      alloc_func zalloc;  /* used to allocate the internal state */
      free_func  zfree;   /* used to free the internal state */
      voidpf     opaque;  /* private data object passed to zalloc and zfree */
  
      int     data_type;  /* best guess about the data type: binary or text
                             for deflate, or the decoding state for inflate */
      uLong   adler;      /* Adler-32 or CRC-32 value of the uncompressed data */
      uLong   reserved;   /* reserved for future use */
  } z_stream;
  
  typedef struct z_stream_s FAR *z_streamp;
  
  typedef struct gz_header_s {
      int     text;       /* true if compressed data believed to be text */
      uLong   time;       /* modification time */
      int     xflags;     /* extra flags (not used when writing a gzip file) */
      int     os;         /* operating system */
      Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
      uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
      uInt    extra_max;  /* space at extra (only when reading header) */
      Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
      uInt    name_max;   /* space at name (only when reading header) */
      Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
      uInt    comm_max;   /* space at comment (only when reading header) */
      int     hcrc;       /* true if there was or will be a header crc */
      int     done;       /* true when done reading gzip header (not used
                             when writing a gzip file) */
  } gz_header;
  
  struct gzFile_s {
      unsigned have;
      unsigned char *next;
      z_off64_t pos;
  };
  </code></pre>
  <p><a href="https://i.stack.imgur.com/v91kF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v91kF.png" alt="enter image description here" /></a></p>
  <p>I replaced the latest zlib.h also but the same redefinition error occurring again.</p>
  <p>These files are used to generate the qrcode</p>
  <p>redefintion issue occurring in all these files</p>
  <p><a href="https://i.stack.imgur.com/8qnJw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8qnJw.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/0CNs7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0CNs7.png" alt="enter image description here" /></a></p>
  <p>When i click the error occur it goes to the line where struct z_stream_s is defined</p>
  <pre><code>typedef struct z_stream_s {
  </code></pre>
  <p>In that error shows that it has been already defined in the file unzip.c</p>
  <p>in the unzip.c when i look into that zlib.h has been include in the both unzip.h and unzip.c</p>
  <p>in unzip.h</p>
  <pre><code>#ifndef _unz_H
  #define _unz_H
  
  #ifdef __cplusplus
  extern &quot;C&quot; {
  #endif
  
  #ifndef _ZLIB_H
  #include &quot;zlib.h&quot;
  #endif
  
  #ifndef _ZLIBIOAPI_H
  #include &quot;ioapi.h&quot;
  #endif
  </code></pre>
  <p>in unzip.c</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &quot;zlib.h&quot;
  #include &quot;unzip.h&quot;
  
  #ifdef STDC
  #  include &lt;stddef.h&gt;
  #  include &lt;string.h&gt;
  #  include &lt;stdlib.h&gt;
  #endif
  #ifdef NO_ERRNO_H
      extern int errno;
  #else
  #   include &lt;errno.h&gt;
  #endif
  </code></pre>
  <p>These files are used to generate the QRCODE</p>
  <p>and the redefinition error continues on file by file zip.c, zip.h, pngpriv.h, pngstruct.h like that it goes on</p>
  <p>Note:The same project is working fine in Xcode 12.4, but in latest Xcode 13 Its shows the redefinition error</p>
  <p>Please help me to resolve this issue.</p>
  <p>Thanks in advance.</p>