How to add external lib (libstatgrab.so) to qtcreator?



  • Hello

    How can I add external lib (libstatgrab.so.10.0.0) to project?
    I want to add libstatgrab (http://www.i-scream.org/libstatgrab) to my project, but I can't. I built lib from source code.

    I tryed to add to ".pro" file this line
    LIBS += -L/home/pawel/Moje_Dokumenty/Programowanie/BibliotekaQT/libstatgrab-test/libs/ -llibstatgrab
    but doesn't work. I tryed to add this path to LD_LIBRARY_PATH, but it doesn't work too.
    What I can do?

    I create simply project to test it. I modified only one file

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <statgrab.h>
    #include <helpers.h>
    MainWindow::MainWindow(QWidget parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    sg_init(1);
    /
    Drop setuid/setgid privileges. */
    // if (sg_drop_privileges() != SG_ERROR_NONE)
    // sg_die("Error. Failed to drop privileges", 1);
    ui->setupUi(this);
    }
    MainWindow::~MainWindow()
    {
    delete ui;
    }

    Linker shows me
    :-1: error: cannot find -llibstatgrab
    :-1: error: collect2: error: ld returned 1 exit status


  • Qt Champions 2018

    Replace -llibstatgrab with -lstatgrab in your .pro file (lib prefix is added automatically, so you should not use it)