[SOLVED] C libraries using QT


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);
   qDebug() << "ERROR";


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 .pro file:

LIBS += -lcap

It should do the trick.

Answered By – Wisblade

Answer Checked By – Katrina (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *