title: Unable to link libpng or zlib in Eclipse with MinGW C linker
body: <p>I'm new to external static libraries in C, and i'm having trouble adding pnglib (or any library) to Eclipse. Im using Eclipse v3.3.2 with mingw on windows 7 64bit.</p>
  
  <p>I first followed these instructions to install libpng and zlib: <a href="http://wiki.openttd.org/Compiling_on_MinGW" rel="nofollow">http://wiki.openttd.org/Compiling_on_MinGW</a></p>
  
  <p>Then in Eclipse under <strong>C/C++ Build</strong> -> <strong>Settings</strong> -><strong>Tool Settings</strong> -> <strong>MinGW C Linker</strong> -> <strong>Libraries</strong></p>
  
  <p>I added: <strong>"png"</strong> then <strong>"z"</strong> in Libraries (-l)</p>
  
  <p>and: <strong>"C:\MinGW\libpng-1.5.12"</strong> then <strong>"C:\MinGW\zlib-1.2.7"</strong> in the Library search path (-L)</p>
  
  <p>If I execute the simplest code: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;zlib.h&gt;
  #include &lt;png.h&gt;
  
  int main(void) {        
  
      printf("foo\n");
  
      unsigned char header[8];
      //png_sig_cmp(header, 0, 0);    
  
      return 0;
  }
  </code></pre>
  
  <p>It works fine, however as soon as i uncomment the function, the code compiles (without error/warning), but does absolutely nothing, (not even the print statement). This happens when I use ANY function from an external library.  </p>
  
  <p>I assume it can read the headers but there's funny business with finding function definitions. </p>
  
  <p>I have no idea where i went wrong. </p>
  
  <p>I'm sure I have missed something trivial!</p>