Reputation: 10996
I am using qt and qmake to generate the makefile for my C++ project and I recently pulled in a sub-project from another group which uses libpng functionality in their code. When I tried to compile it, it gave undefined reference for PNG functions like:
undefined reference to symbol png_set_sig_bytes
So, I was guessing that I need to link to limping
. What I did was added something like:
LIBS += png
Also tried
LIBS += libpng
Both of these commands ended up with No such file for directory error
.
Can someone point out how I can link to the png library from a make pro file?
Upvotes: 1
Views: 431
Reputation: 10996
Ok, I figured it out, I needed to do:
LIBS += -lpng
This is assuming that the library can be found in the path where the compiler looks. Else, the path needs to be added with a -L
flag as well.
Upvotes: 1