Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to add external lib (libstatgrab.so) to qtcreator?
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved General and Desktop
qtcreatorshared library
2 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PawlosCK
    wrote on last edited by PawlosCK
    #1

    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

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved