未加载QIBASE驱动程序

时间:2017-05-11 10:13:29

标签: linux qt ubuntu

qt5.7 see link的编译库。但是,我无法将其连接到项目。请告诉我可能出现的问题以及如何实现?

的main.cpp

#include <QCoreApplication>
#include <QtSql>
#include <QPluginLoader>


int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);


    QPluginLoader loader;
    loader.setFileName("/home/alexandr/Qt/5.7/Src/qtbase/plugins/sqldrivers/libqsqlibase.so");
    qDebug() << loader.load();
    qDebug() <<  loader.isLoaded();
    qDebug() << loader.errorString();

    QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE");
    qDebug() << QString("Cannot open database") << db.lastError();

    QCoreApplication::exit(0);
}

qibase.pro

QT += core
QT -= gui
QT += sql

CONFIG += c++11
TARGET = qibase
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

控制台

true
true
"Unknown error"
QSqlDatabase: QIBASE driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
"Cannot open database" QSqlError("", "Driver not loaded", "Driver not loaded")

1 个答案:

答案 0 :(得分:0)

问题是你必须在创建正确的Assembly Kit之后使用qmake编译插件qibase的相同版本,问题就消失了。