title: How to avoid "error LNK2005:" (already defined stdlib functions) when compiling libpng with Microsoft Visual Studio '08?
body: <p>(Why I am trying to do this: I have had no luck in using the pre-built binaries for libpng on Windows (despite many hours of trial and error), and therefore am now trying to compile it myself. I found <a href="http://bobobobo.wordpress.com/2009/03/02/building-libpng-in-visual-studio-2008/" rel="noreferrer">this helpful blog post</a> concerning this, complete with a Microsoft Visual Studio 2008 project file, but unfortunately have still not been able to use it.)</p>
  
  <p>It successfully compiles when linking to the zlib binary found <a href="http://go2.wordpress.com/?id=725X1342&amp;site=bobobobo.wordpress.com&amp;url=http%3A%2F%2Fwww.zlib.net%2Fzlib123-dll.zip" rel="noreferrer">here</a>, but when attempting to link it to a test file I receive the following:</p>
  
  <pre>
      C:\Documents and Settings\Administrator\My Documents>cl "C:\Documents and Settin
      gs\Administrator\My Documents\test.c" "C:\Documents and Settings\Administrator\M
      y Documents\libpng.lib" -I "C:\Documents and Settings\Administrator\My Documents\include"
  
      Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
      Copyright (C) Microsoft Corporation.  All rights reserved.
  
      test.c
      Microsoft (R) Incremental Linker Version 9.00.30729.01
      Copyright (C) Microsoft Corporation.  All rights reserved.
  
      /out:test.exe
      test.obj
      "C:\Documents and Settings\Administrator\My Documents\libpng.lib"
      MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _abort already defined in LIBCMT.lib(
      abort.obj)
      MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _fread already defined in LIBCMT.lib(
      fread.obj)
      MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _malloc already defined in LIBCMT.lib
      (malloc.obj)
      MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _free already defined in LIBCMT.lib(f
      ree.obj)
      MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: ___iob_func already defined in LIBCMT
      .lib(_file.obj)
      LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
      se /NODEFAULTLIB:library
      test.exe : fatal error LNK1169: one or more multiply defined symbols found
  </pre>
  
  <p>Could anyone care to shed some light as to how to fix these errors?</p>