October 15, 2010

Grzegorz Szewczyk Grzegorz Szewczyk
Lab Rat
4 posts

[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 [doc.trolltech.com]) that I have to build QMYSQL plug-in. OK. I succeeded to execute two commands from the command line:

  1. cd %QTDIR%\src\plugins\sqldrivers\mysql
  2. 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:

  1. qmake "INCLUDEPATH+=C:\\MySQL\\include" "LIBS+=C:\\MYSQL\MySQL Server <version>\\lib\\opt\\libmysql.lib" mysql.pro
  2. 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]

2 replies

October 15, 2010

Tobias Hunger Tobias Hunger
Mad Scientist
3150 posts

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.qt.nokia.com] which usually is faster than nmake;-)

October 15, 2010

Grzegorz Szewczyk Grzegorz Szewczyk
Lab Rat
4 posts

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,
Grzegorz

 
  ‹‹ Using dumpcpp      qmake wiki page ››

You must log in to post a reply. Not a member yet? Register here!