Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
"No rule to make target" error, when adding an external library to Qt Widget project.
Hello, i have a problem with adding an external library, called "libpng". I tried to change *.pro in different ways. First of all i tried adding those lines of code:
INCLUDEPATH += $usr/local/libpng/include LIBS += -L$usr/local/libpng/lib -lpng
This is a default folder of libraries. It didn't work. After i downloaded all the files of "libpng" library manually and added those lines of code:
INCLUDEPATH += $usr/Qt/bin/headers LIBS += $usr/Qt/bin/lib/libpng.lib -lpng
But there still was an error like this:
'png.h' file not found
Later i found out that i can add an external library via Qt Creator menu. I did it, so now i have this error:
:-1: Error: No rule to make target
/Users/nikitababenko/CProjects/coursework2/bin/lib/liblibpng.a', needed by coursework2.app/Contents/MacOS/coursework2'. Stop.
Can anyone help me? Thanks everyone in advance. If you would need anything else from me, i would be glad to assist.
really $usr and not /usr? What OS are you using?
@Christian-Ehrlicher I use Mac OS and don't really know which one is correct. Found this solution somewhere on stackoverflow.
Hi and welcome to devnet,
Where exactly are these files located on your system ?
@SGaist Hello, files, which were downloaded manually are located in /Qt/bin/
libpng, which was downloaded via cmd, is located in /usr/local/lib
Then that's the path you should be using:
-L/usr/local/libor the subdirectory matching where the library is located.
@SGaist Wow, i feel so dumb now, i spend the whole day trying to connect it, and the solution is so simple. Thank you very much!