Installing zlib, libpng & loadpng for mingw

This is how I get PNG support working with Allegro on mingw. I'm assuming you already have mingw and Allegro set up on your machine.

  1. Download the precompiled zlib and libpng packages from

    For the extremely lazy, just left-click these:

  2. Run both the installers. When prompted, point them to your mingw root directory, e.g. c:\mingw . You don't need to install the documentation or download sources if you don't want to.

  3. To test loadpng, unzip loadpng somewhere. Open a command prompt (e.g. Start -> Run -> "cmd" on Windows XP), cd into the loadpng directory, and run make (using either "make" or "mingw32-make"). loadpng and its examples should be compiled.

  4. To use loadpng in your own application, I suggest you copy loadpng's source files into your own project directory and compile them as if they were your own files. Otherwise you may run "make install" to install loadpng's library and header files into your mingw directory.

  5. When linking your own programs, remember that you need to use the -lz -lpng arguments, as well as loadpng itself. e.g. gcc mygame.c -lz -lpng -lldpng -lalleg or gcc mygame.c loadpng.c -lz -lpng -lalleg

Go back

Back to Psyk Software homepage.