C libraries using QT

Ekaterina

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?

Wisblade

Add this line to your .pro file:

LIBS += -lcap

It should do the trick.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324257264&siteId=291194637