c++qtparted

Qt link to libparted error


currently I want to make a Qt application that able to read the HDD partition (maybe in the future able to make patitions on HDD). And I found that libparted can be used for this (my application will be only for Linux).

Already install libparted on machine and here my simple code :

#include "parted/device.h"
...
void MainWindow::test() {
    ped_device_probe_all();
}

And add this libs to qmake

LIBS += -lparted

But have error linker :

undefined reference to `ped_device_probe_all()'

I am not sure whats wrong with my code, is there anyone has the problem, need help please.


Solution

  • You have to add parted.h:

    #include <parted/parted.h>
    #include <parted/device.h>
    ... 
    void MainWindow::test() {
        ped_device_probe_all();
    }