[SOLVED][Qt5.0.1 static] QtCreator doesn't see MySQL plugin



  • I build Qt with:
    @
    configure -static -platform win32-msvc2012 -qt-sql-mysql -plugin-sql-mysql -no-angle -no-icu -opengl desktop -nomake demos -nomake examples@

    and now i'm trying to build the most simple program in Qt which will only print available sql plugins. I have no idea why, but this code:

    @#include "mainwindow.h"
    #include <QApplication>
    #include <QtSql/QSqlDatabase>
    #include <QMessageBox>
    #include <QStringList>

    #pragma comment(lib, "Qt5Sql.lib")

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    QStringList lista = QSqlDatabase::drivers();
    for(int i = 0; i < lista.length(); ++i)
    QMessageBox::information(NULL, "asd", QApplication::tr("%1").arg(lista[i]));
    MainWindow w;
    w.show();

    return a.exec&#40;&#41;;
    

    }@

    *.pro file:

    @QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = jakistam
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui@

    shows only qsqlite as available plugin. Of course in qtbase/plugins/sqldrivers i have got mysql libs. Any ideas what is going on?



  • I worked with ODBC and OCI and I had to add this "sql" to .pro file. Like this:
    QT += core gui sql

    Hope it helps!!


  • Lifetime Qt Champion

    Hi,

    since you have build Qt static have a look at "the plugin doc":http://qt-project.org/doc/qt-5.0/qtcore/plugins-howto.html#static-plugins , it explains how to work with static plugins



  • Thank you SGaist. I have followed steps from this link and it turned out that i had to copy libmysql libs from MySQL folder to qtbase/lib. Now everything works perfectly fine.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.