GCC can't find QSqlDatabase!!
I'm having a strange problem, gcc don't find the QSql libraries!!
Look my ManipulaBanco.h:
#ifndef MANIPULABANCO_H
#define MANIPULABANCO_H
#include <QMessageBox>
#include <QSqlError>
#include <QSqlDatabase>
#include <QSqlQuery>
class ManipulaBanco{
Q_OBJECT
public:
ManipulaBanco(void);
private:
bool conecta(void);
QSqlDatabase banco;
};
#endif
when I do make:
In file included from main.cpp:3:
bd/ManipulaBanco.h:5:21: error: QSqlError: Can't find this file or directory
bd/ManipulaBanco.h:6:24: error: QSqlDatabase: Can't find this file or directory
bd/ManipulaBanco.h:7:21: error: QSqlQuery: Can't find this file or directory
bd/ManipulaBanco.h:15: error: 'QSqlDatabase' does not name a type
bd/ManipulaBanco.h:9: warning: 'class ManipulaBanco' has virtual functions but non-virtual destructor
make: ** [main.o] Erro 1
You can see that QMessageBox was found but the others didn't!!
How can I resolve this??
Re: GCC can't find QSqlDatabase!!
Have you added QT += sql to your pro file?
Re: GCC can't find QSqlDatabase!!
Only core and gui modules are enabled by default. To enable sql, add
to the .pro file and re-run qmake.
Edit: d*mnit, forgot to preview :p
Re: GCC can't find QSqlDatabase!!
Oh guys!! Thank you!!
Now I don't have any problem here!!
All time I do: q make -project I should re-edit the .pro file??
Re: GCC can't find QSqlDatabase!!
I have another question for you. I compiled the program but like you can see, I don't have the postgre driver:
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers:
Where I can find the driver and how I install it?? I'm using postgre-8.2
Re: GCC can't find QSqlDatabase!!
Quote:
Originally Posted by
brevleq
All time I do: q make -project I should re-edit the .pro file??
Usually you do "qmake -project" only once, at the beginning of the project. From there on, you just add new files to the .pro and re-create makefiles by running "qmake". There is no need to re-create the .pro every time, because, as you have noticed, you will lose all the changes you've done.
Quote:
Originally Posted by
brevleq
Where I can find the driver and how I install it?? I'm using postgre-8.2
You should build Qt with psql support. See "configure -help" for more details.