hey all,

I'm using Qt4.4.1 and trying to connect to mysql database using the following code:
Qt Code:
  1. QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
  2. db.setHostName("acidalia");
  3. db.setDatabaseName("customdb");
  4. db.setUserName("mojito");
  5. db.setPassword("J0a1m8");
  6. bool ok = db.open();
To copy to clipboard, switch view to plain text mode 

i also include
Qt Code:
  1. #include <QtSql>
  2. #include <QSqlDatabase>
To copy to clipboard, switch view to plain text mode 

but i get the following error:

Qt Code:
  1. src\mainwindowimpl.cpp: In member function `void MainWindowImpl::fileNew()':
  2. src\mainwindowimpl.cpp:124: error: `QSqlDatabase' undeclared (first use this function)
  3. src\mainwindowimpl.cpp:124: error: (Each undeclared identifier is reported only once for each function it appears in.)
  4. src\mainwindowimpl.cpp:124: error: expected `;' before "db"
  5. src\mainwindowimpl.cpp:125: error: `db' undeclared (first use this function)
  6. src\mainwindowimpl.cpp:129: warning: unused variable 'ok'
  7. mingw32-make.exe[1]: *** [build/mainwindowimpl.o] Error 1
  8. e:\qt\MinGW\bin\mingw32-make.exe: *** [release] Error 2
To copy to clipboard, switch view to plain text mode 

i know it's been answered before in this forum here: http://www.qtcentre.org/forum/f-newb...blem-5861.html

but i followed the solution and yet it didn't work for me.

Any ideas!?

thanks in advance.