I have a QT application that requires the MySql driver. I have both a .pro file to compile the app with QtCreator and a .vcproj for Visual C++ 2008 Express. The code is identical and it compiles without a hitch, but the executable created by Visual C++ Express gives me the following output and refuses to load any driver/plugin:

QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers:

I used QCoreApplication to identify the location where the plugins are and it seems that both executables have the same path, so they should both see the plugins. One does, and the other doesn't.

The code is standard.

Qt Code:
  1. db = QSqlDatabase::addDatabase("QMYSQL");
  2. db.setHostName("localhost");
  3. db.setPort(3306);
  4. db.setDatabaseName("dbase");
  5. db.setUserName("user");
  6. db.setPassword("pwd");
  7. bool ok = db.open();
To copy to clipboard, switch view to plain text mode 

The same thing happens with the SqlBrowser sample that came with QT, so I don't think the code is the problem.