This question asked hundred times in the net but it seems this programmer nightmare fear. So, I have problem in loading sqlite when the program executed, I tried many thinks and I end with this:
Main.cpp:
Qt Code:
  1. #include <QApplication>
  2. //#include <qDebug>
  3. #include "store.h"
  4. #include <QtPlugin>
  5. #include <QCoreApplication>
  6. #include <QSqlDriverPlugin>
  7. #include <qsql_sqlite.h>
  8. #include <qsqldriver.h>
  9. #include <QPluginLoader>
  10.  
  11.  
  12. int main(int argc, char **argv)
  13. {
  14. QApplication app(argc, argv);
  15. Q_IMPORT_PLUGIN(qsqlite)
  16.  
  17. Store window;
  18. window.show();
  19. return app.exec();
  20. }
To copy to clipboard, switch view to plain text mode 
Store.pro:
Qt Code:
  1. TEMPLATE = app
  2. TARGET =
  3. DEPENDPATH += .
  4. INCLUDEPATH += .
  5.  
  6. # Input
  7. HEADERS += items.h store.h \
  8. sales.h \
  9. workers.h
  10. FORMS += Store.ui
  11. SOURCES += items.cpp main.cpp store.cpp \
  12. sales.cpp \
  13. workers.cpp
  14.  
  15. LIBS += -L"D:\Qt\4.7.4\plugins\sqldrivers" -lqsqlite
  16. QT += sql
  17. QTPLUGIN += qsqlite
  18. CONFIG += debug static
To copy to clipboard, switch view to plain text mode 
When I compile:
Qt Code:
  1. g++ -mthreads -Wl,-subsystem,windows -o debug\Store.exe debug/items.o debug/main.o debug/store.o debug/sales.o debug/workers.o debug/moc_store.o -L"d:\Qt\4.7.4\lib" -lmingw32 -lqt
  2. maind -LD:\Qt\4.7.4\plugins\sqldrivers -lqsqlite -LD:/Qt/4.7.4/plugins/sqldrivers -lqsqlited -lQtSqld4 -lQtGuid4 -lQtCored4
  3. debug/main.o: In function `StaticqsqlitePluginInstance':
  4. C:\Documents and Settings\Administrator\Desktop\Store-dev/main.cpp:15: undefined reference to `qt_plugin_instance_qsqlite()'
  5. collect2: ld returned 1 exit status
  6. mingw32-make: *** [debug\Store.exe] Error 1
To copy to clipboard, switch view to plain text mode