PDA

View Full Version : connect to mysql in Qt Creator 2.6.1



smemamian
1st July 2013, 21:11
hi

i want to connect to mysql but I get this error message:


c:\qt\qt5.0.0\5.0.0\msvc2010\include\qtsql\qsql_my sql.h:52: error: C1083: Cannot open include file: 'mysql.h': No such file or directory


#include <QtSql/QMYSQLDriver>
#include <QMessageBox>
#include <QtSql/QSqlDatabase>

why ?

tnx

Added after 1 55 minutes:

I am using Windows seven..

ChrisW67
1st July 2013, 21:58
You have to build the Qt MySql plugin following the instructions in the docs. Then, rather than guess how to use a database from Qt, I suggest you read some of the QSqlDatabase and related documentation, and related examples.

smemamian
2nd July 2013, 06:09
According your address is :


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


I get this error message:


cannot find file : mysql.pro

9259

ChrisW67
2nd July 2013, 23:22
You need the Qt library source code in order to build all or part of the Qt library from source code