Important: Please read the Qt Code of Conduct -

trying to open .so with QLibrary

  • hello,
    i'm trying to open a .so (i made it in c++) with QLibrary, i've been trying many option but nothing seems to work
    here is my class witch use QLibrary


        ruleName = new QLineEdit;
        statement = new QLineEdit;
        value = new QLineEdit;
        updateButton = new QPushButton("Update Rule");
        QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(update()));
        layout = new QFormLayout;
        layout->addRow("Rule Name", ruleName);
        layout->addRow("Statement", statement);
        layout->addRow("Value", value);
    void UpdateWindows::update(){
        QLibrary myLib("libWESTGARD-SSM") ;
        typedef EUpdateResult (*MyPrototype)(bool);
            MyPrototype resultUpdate =(MyPrototype) myLib.resolve("updateEvaluateParameterizableRulesIf1_2sSucceed");
                EUpdateResult Eur = resultUpdate(false);
                if(Eur == UPDATE_OK){
                    QMessageBox msgBox;
                    msgBox.setText("Eur update ok");
                QMessageBox msgBox;
                msgBox.setText("fonction failed");

    i also tried to add a library inside the .pro

    QT += widgets
    SOURCES += \
        main.cpp \
        mainwindows.cpp \
        evaluationwindows.cpp \
        updatewindows.cpp \
    HEADERS += \
        mainwindows.h \
        evaluationwindows.h \
        EUpdateResult.h \
        updatewindows.h \
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Westgard-SSM/lib/release/ -lWESTGARD-SSM
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Westgard-SSM/lib/debug/ -lWESTGARD-SSM
    else:unix: LIBS += -L$$PWD/Westgard-SSM/lib/ -lWESTGARD-SSM
    INCLUDEPATH += $$PWD/Westgard-SSM/lib
    DEPENDPATH += $$PWD/Westgard-SSM/lib

    but doesn't work as well

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you sure you library can be found ?

    What version of Qt are you using ?
    On what platform ?

Log in to reply