title: Can't compile with zlib dependency on Windows?
body: <p>I'm trying to port a program that uses zlib to Windows with MSVC. Unfortunately, though, after many hours of trying I can't seem to get anything referencing zlib to run.</p>
  
  <p>Here's a dummy program I'm using to test whether zlib can run:</p>
  
  <pre><code>#include &lt;zlib.h&gt;
  #include &lt;stdio.h&gt;
  
  int main(void)
  {
      z_stream zst;
      zst.zalloc = Z_NULL;
      zst.zfree = Z_NULL;
      zst.opaque = Z_NULL;
      zst.next_out = Z_NULL;
      zst.next_in = Z_NULL;
      zst.avail_out = 0;
  
      inflateInit(&amp;zst);
  
      puts("hello, world!");
  
      return 0;
  }
  </code></pre>
  
  <p>After installing zlib by copying the contents of the zlib DLL archive found <a href="http://www.zlib.net/" rel="nofollow noreferrer">here</a> into their respective GnuWin32 directories (as the setup found <a href="http://gnuwin32.sourceforge.net/packages/zlib.htm" rel="nofollow noreferrer">here</a> appeared to include an invalid header), I attempted compile the test program with the following:</p>
  
  <pre><code>C:\Documents and Settings\Administrator\My Documents&gt;cl test.c -I"C:\Program Files\GnuWin32\include" "C:\Program Files\GnuWin32\lib\zlib.lib"
  Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.0 for 80x86
  Copyright (C) Microsoft Corporation. All rights reserved
  
  test.c
  Microsoft (R) Incremental Linker Version 9.0030729.01
  Copyright (C) Microsoft Corporation. All rights reserved.
  
  /out:test.exe
  test.obj
  "C:\Program Files\GnuWin32\lib/zlib.lib"
  </code></pre>
  
  <p>Then, when I attempt to run test.exe, I get an error dialog stating:</p>
  
  <blockquote>
    <p>This application has failed to start
    because zlib1.dll was not found.
    Re-installing the application may fix
    this problem.</p>
  </blockquote>
  
  <p>Any help would be very much appreciated.</p>