Important: Please read the Qt Code of Conduct -

Mysql in qt5

  • Hi All.
    I have tested my application in Qt5 but I have a problem with mysql driver. It's not installed :-(

    I tried to compile the drive in Linux, but I have error. This is the command I have used for compile.

    @qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib -lmysqlclient_r"

    And the answer is:

    WARNING: /home/arcnexus/Qt5.0.0/5.0.0/Src/qtbase/src/plugins/sqldrivers/qsqldriverbase.pri:4: Unable to find file for inclusion qt_plugin Project MESSAGE: Warning: unknown QT: sql-private

    Please anyone know how to compile the driver in Qt5 and Linux?

  • I have the same problem....

    Can anybody help us?

    Thank in advance.

  • Hi All,

    after several hours I've finally found quite a simple solution:

    • Open the .pro in src/plugins/sqldrivers/psql (or mysql) with the Qt Creator.
    • Modify the include in the Build Settings
    • Build

    In my case and after a message in the Creator I had to create /plugins temporarily then build again and move the to Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers

    Works perfect now!

  • Hi clochydd.

    Modify de include with.....?

    I don't understand.

    If I compile mysqldriver. when I build project I obtain this error:

    :-1: error: Unknown module(s) in QT: qt

    do you know also about this?

  • Hi ArcNexus,

    in my case, I had to add "INCLUDEPATH+=/usr/include/postgresql" in the Build section and you should add a similar include for your mysqldriver.

    I had lots of error messages like "Unknown modules" etc. - but it was all solved the described way.

    I hope this may help you.

  • Thanks :

    Yes, the problem is in the paths, I have solved this in part, but where is #include "main.moc"? I have searched this in my / directory but don't find it.

    this include is in my main.cpp. :-(

  • Thanks clocydd, I have solved it with compiling QBase code cloned from Github, in Archlinux

Log in to reply