[Solved] MySQL and Qt on Windows 7.

  • Hi Everybody!

    I am struggling with connection of Qt program to MySQL database on Windows 7 operating system. I learned from the documentation ("http://doc.trolltech.com/4.6/sql-driver.html#qmysql-for-mysql-4-and-higher":http://doc.trolltech.com/4.6/sql-driver.html#qmysql-for-mysql-4-and-higher) that I have to build QMYSQL plug-in. OK. I succeeded to execute two commands from the command line:

    cd %QTDIR%\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro

    However, the above presented qmake command is written in the form is presented in the documentation. This form is wrong. The correct one is as follow:

    qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro
    C/C++ language string form!

    Next, the documentation requires to run nmake command. The only nmake command I found is related to ... Visual Studio 10. Is this the one I should use?

    Best regards, Grzegorz

    [edit: fixed link and code markup / chetankjain]

  • Moderators

    Which compiler was used to build your Qt? This is either mingw or msvc. Mingw usually comes with its own make which I usually prefer to nmake. If your Qt was build with msvc, then nmake is fine.

    Of course you can also use "jom":ftp://ftp.qt.nokia.com/jom which usually is faster than nmake;-)

  • Hi Tobias,

    I downloaded my Qt as executable from Nokia’s site, so I guess it was compiled with mingw.

    Thanks a lot for the tip and best regards,

Log in to reply

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