Important: Please read the Qt Code of Conduct -

How to add external lib ( to qtcreator?

  • Hello

    How can I add external lib ( to project?
    I want to add 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) :
    ui(new Ui::MainWindow)
    Drop setuid/setgid privileges. */
    // if (sg_drop_privileges() != SG_ERROR_NONE)
    // sg_die("Error. Failed to drop privileges", 1);
    delete ui;

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

  • Lifetime Qt Champion

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