Problem with SqlLite database in Qt SDK 1.0.2
- by Risino
Hi I have a problem with SqlLite database. Here is my code:
void incomeDialog::on_add_pushButton_clicked()
{
int a = ui->income_lineEdit->text().toInt();
int b = ui->other_lineEdit->text().toInt();
int c = (a+b);
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("money.db");
QSqlQuery query(db);
query.exec("create table Income"
"(Month TEXT, Payment NUMBER, Other NUMBER, Together NUMBER)");
query.prepare("INSERT INTO Income values (?,?,?,?)");
query.addBindValue(ui->comboBox->currentText());
query.addBindValue(ui->income_lineEdit->text().toInt());
query.addBindValue(ui->other_lineEdit->text().toInt());
query.addBindValue(c);
query.exec();
}
I use qt sdk 1.0.2. After building shows errors:
Undefined reference to 'QSqlDatabase::addDatabase(QString const&, QString const&)...
all errors is similar (Undefined reference to 'QSqlDatabase::
Do you have any idea how to repair it?