Important: Please read the Qt Code of Conduct -

PostgesSQL and MySQL drivers Qt 5.1.1

  • Hi,
    How can build postgres and mysql drivers for Qt 5.1.1 for windows.
    Thank for help me.

  • Lifetime Qt Champion


    Do you mean building the plugins ?

  • yes, i want to bulding plugins

  • Lifetime Qt Champion

    Then have a look "here": it explains how to do it. You can also search the forum for this topic, it appeared several times

  • This is the batch file we use for building the plugin. Maybe it helps you a little. It is executed from the Visual Studio Command Line.

    echo Copy MySQL input files...

    copy "C:\MySQL\include\mysql.h" "%QTDIR%\include"
    copy "C:\MySQL\include\mysql_version.h" "%QTDIR%\include"
    copy "C:\MySQL\include\mysql_com.h" "%QTDIR%\include"
    copy "C:\MySQL\include\mysql_time.h" "%QTDIR%\include"
    copy "C:\MySQL\include\typelib.h" "%QTDIR%\include"
    copy "C:\MySQL\include\my_list.h" "%QTDIR%\include"
    copy "C:\MySQL\include\my_alloc.h" "%QTDIR%\include"

    copy "C:\MySQL\lib\libmysql.lib" "%QTDIR%\lib"
    copy "C:\MySQL\lib\libmysql.dll" "%QTDIR%\bin"

    echo Building MySQL plugin...

    cd /D "%QTDIR%..\src\qtbase\src\plugins\sqldrivers\mysql"
    nmake clean
    qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MYSQL/lib/libmysql.lib"
    nmake debug
    nmake release

    echo Copy MySQL output files...

    cd /D "%QTDIR%..\src\qtbase\plugins\sqldrivers"

    copy qsqlmysqld.dll "%QTDIR%\plugins\sqldrivers"
    copy qsqlmysqld.lib "%QTDIR%\plugins\sqldrivers"

    copy qsqlmysql.dll "%QTDIR%\plugins\sqldrivers"
    copy qsqlmysql.lib "%QTDIR%\plugins\sqldrivers"

Log in to reply