Hi I am trying to use QSqlDatabase, but I am getting build errors and QTCreator doesn't seem to know that QSqlDatabase exists? The IDE is not even auto-completing my typing, etc.
Running build steps for project app13_sqlite3...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w
make: Entering directory `/home/yadav/dev/cpp/QT_Samples/app13_sqlite3-build-desktop'
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../app13_sqlite3 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I../app13_sqlite3 -I. -o dialog.o ../app13_sqlite3/dialog.cpp
../app13_sqlite3/dialog.cpp:4: fatal error: QSqlDatabase: No such file or directory
Try to add
QT += sql
to your project file
still getting the same error, btw where do i add that? to the project setting -> build steps -> additional arguments ??
also I can't even navigate to QSqlDatabase.h ? using follow symbol under cursor from the IDE, is there something wrong. should this not work with a default SDK install
ok i figured it out, I needed to
You have .pro file in your project tree. Just add stuff I've said you there and all will be ok.
thanks again, that helped me figure out where to also add the linker stuff so my exe would run without an error
LIBS += -lsqlite3
You don't need to add that lib. It is already linked against the Qt SQLite plugin.
Andre thanks, didn't know that, removed the explicit linkage.