I need to use functions from capability.h library inside my QT project. So I’ve successfully included <sys/capability.h> in my cpp file and tried this:
char *result = NULL; ssize_t length; cap_t caps; path = "/*path/*"; caps = cap_get_file(path); if (caps) result = cap_to_text(caps, &length); else qDebug() << "ERROR"; cap_free(caps);
Now I have problems like "undefined reference to
cap_get_file" with cap_get_file, cap_to_text and cap_free functions. What am I doing wrong and how should I use linux system libraries in QT?
Add this line to your
LIBS += -lcap
It should do the trick.
Answered By – Wisblade
Answer Checked By – Katrina (BugsFixing Volunteer)