title: Zlib linker error on vs2010
body: <p>I have a zlib linker error. Spent several hours to try and solve the problem but nothing so far. Zlib was built using vs2010, win32 release. My project is using the same.</p>
  
  <p>Error extract:</p>
  
  <pre><code>error LNK2019: unresolved external symbol _deflateEnd@4 referenced in function
  error LNK2019: unresolved external symbol _deflate@8 referenced in function
  error LNK2019: unresolved external symbol _deflateInit_@16 referenced in function
  </code></pre>
  
  <p>Including the zlib.h in the file like this:</p>
  
  <pre><code>#ifdef WIN32
  # define ZLIB_WINAPI
  #endif
  #include "zlib.h"
  </code></pre>
  
  <p>Project settings:</p>
  
  <p><strong>Linker->General->Additional Library Dependencies</strong>: C:\somepath\zlib</p>
  
  <p><strong>Linker->Input->Additional Dependencies</strong>: zlibstatic.lib</p>
  
  <p>Linker verbose output (not full, just for zlib):</p>
  
  <pre><code>Searching C:\somepath\zlib\zlibstatic.lib:
  Searching C:\somepath\zlib\zlibstatic.lib:
  </code></pre>
  
  <p>Two direct hits yet it doesn't do anything..</p>
  
  <p>I saw <a href="https://stackoverflow.com/questions/5424549/unresolved-externals-despite-linking-in-zlib-lib">this</a> question but I do not think I have that problem because:</p>
  
  <ol>
  <li>I did not use contrib solution, I generated one with <strong>cmake -G
  "Visual Studio 10"</strong></li>
  <li>I have ZLIB_WINAPI defined before include as
  comment to top answer suggests.</li>
  </ol>
  
  <p>It is actually an open source project so if someone can try and reproduce the problem:</p>
  
  <ol>
  <li>Clone <a href="https://github.com/d1zzy/pvpgn.git" rel="nofollow noreferrer">https://github.com/d1zzy/pvpgn.git</a></li>
  <li>Add zlib libraries and include files to pvpgn/pvpgn/zlib (or anywhere else, just edit cmake/Modules/FindZLIB.cmake with your custom zlib path)</li>
  <li>Run cmake -G "Visual Studio 10", open the solution and try to build project "bnetd"</li>
  </ol>