How to install libpng correctly?
You said in the comments that you use gcc my_code.c
, try
gcc my_code.c -lpng
The -l
flag links a library, in this case libpng12-dev
.
Linking means that your compiler adds the code from all the object files to create a single executable file. The object files are the separate compiled source code files (the .o
files).