Important: Please read the Qt Code of Conduct -

Error QSQLITE driver not loaded, but the driver is there and it's called after QApplication!

  • First I've to say that it was working after some problems I got with Qt versions and then I had to compile Qt4.8 from sources.

    Now when I ran my application I get this error:
    QSqlDatabase: QSQLITE driver not loaded
    QSqlDatabase: available drivers:

    but the sqlite driver is there: /usr/local/Trolltech/Qt-4.8.0/plugins/sqldrivers/
    libqsqlite.dylib libqsqlite_debug.dylib

    Then I put this line of code:
    QApplication::addLibraryPath( "/usr/local/Trolltech/Qt-4.8.0/plugins/" );

    And it's working... but I want to know a better way to solve this problem, and I don't think my solution will gonna work in others computers.

    I'm running on a OSX 10.6
    GCC 4.2
    Qt 4.8 compiled with dbus disabled and as framework.

    PS: The call to SQLITE is after QApplication constructor

  • Hi..

    I think that by default qt application try to load the plugins in the same path of your executable.
    You can try it by creating this structure in the same directory of your app.

    • plugins / sqldrivers
      and put your available drivers there. (libqsqlite.dylib libqsqlite_debug.dylib)

    QT_PLUGIN_PATH, that in your system is /usr/local/Trolltech/Qt-4.8.0/plugins/.

    you should read "this":

  • If the program is executed from within your enveloper build, it should find the plugins in Qt. If you want to run it on a user computer, you need to run macdeployqt on it. It will add the necessary Qt plugins to the bundle.

    Check out for more details.

  • I'm running under Qt Creator...
    I've created a variable QT_PLUGIN_PATH and it works... but I guess it's not the real problem, right? Because it should find my plugins at first, right?

Log in to reply