I am totally new to lib png and png++ and have recently made my first project with these on linux. But have no idea how to use png++ on windows. I have my libpng configured on windows and am wondering how to move towards making png++ available and running my code which I have already built on linux and now i want to run it on windows with visual studio 2008.
I would be very grateful if someone can give some pointers. I have a deadline.


4 Years
Discussion Span
Last Post by muhammads

From what little I've read about it here you shuld prolbably use Code::Blocks with MinGW, which is the windows port of GCC because png++ is documented to work with gcc and not VC++. That's not to say you can not use vc++, just that the port will be easier with Code::Blocks.

Edited by Ancient Dragon


Thanks Ancient Dragon. From the same document you mentioned in your answer i see the following instructions for linux and have no idea how to translate it to VC++. For code blocks, i have no idea about MinGW/ Code block and with that (according to my understanding) i would have to start with Zlib and LibPng first and then move to png++. and since i have already made libpng worked with VC i would love to move on from here and translate the following for VC+.

Follow these instructions in order to install png++:

  • Unpack source package:

    $ tar -zxf png++-0.2.x.tar.gz -C ~/src

  • Go to your brand new png++ sources directory:

    $ cd ~/src/png++-0.2.x

  • Issue make to test how it's doing:

    $ make

This will compile examples in the example/ directory.

As always, CFLAGS and LDFLAGS could be used to adjust compilation. In
addition, you might want to specify custom libpng-config. Use
LIBPNG_CONFIG variable for that purpose, like this:

$ make LIBPNG_CONFIG=~/bin/libpng-config

If everything goes well, try:

$ make test

(or "make check" which is the same as above). This will run the test
suite. If tests do not produce error messages then probably all is

  • Now you can create documentation (optional). Use

    $ make docs

to run doxygen in the sources directory.

  • Now it is time to become root and install png++ into your system:

    make install

It's OK to issue "make install" under ordinary user permissions if you
want to install png++ into your home directory. Run the following

$ make install PREFIX=$HOME

This will copy png++ header files to ~/include/png++ and documentation
files to ~/share/doc/png++-0.2.x (if the docs were built).

Without a PREFIX png++ installs to /usr/local


One more thing, I have to have a windows executable too for my project so i guess i haveno other way than doing it on VC++. BTW, just for learning i have gone forward with MinGW/MSys and have libpng working but for png++ this is the result

@PC_Home ~/png++-0.2.5
$ make
make -C example
make[1]: Entering directory /home/XXXX/png++-0.2.5/example
g++     pixel_generator.cpp   -o pixel_generator
pixel_generator.cpp:35:19: fatal error: png.hpp: No such file or directory
compilation terminated.
make[1]:  [pixel_generator] Error 1
make[1]: Leaving directory /home/XXXX/png++-0.2.5/example
make:  [examples] Error 2

You are going to have to create a new lib project in vc++ then, using the makefile you have from *nix figure out what *.c and/or *.cpp files need to be added to that new project. The task won't be easy because makefiles have a tendency to include other files. I have NOT done this nor do I intend to do it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.