Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED][Qt5.0.1 static] QtCreator doesn't see MySQL plugin

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

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 3 Posters 2.9k Views 1 Watching
  • 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.
  • V Offline
    V Offline
    viXon
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BelenMuñoz
      wrote on last edited by
      #2

      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!!

      Me casé con un enano pa jartarme de reí.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • V Offline
          V Offline
          viXon
          wrote on last edited by
          #4

          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.

          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