PDA

View Full Version : Sql concept error solving



Tavit
27th March 2008, 10:32
Hi,
I am doing programing in Qt4.3.3 Integrated with VS2005.
I have one doubt while doing the basic Sql program i am geeting these errors.
Can you tell me any one..Please..

I Added code & Errors in below

------------------connection.h-----------------------------

#ifndef CONNECTION_H
#define CONNECTION_H

#include <QMessageBox>
#include <QSqlDatabase>

inline bool createConnection()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(":memory:");
if (!db.open()) {
QMessageBox::warning(0, QObject::tr("Database Error"),
db.lastError().text());
return false;
}
return true;
}/*

------------------main.cpp-------------------

#include <QtGui/QApplication>
#include <QtSql>
#include "connection.h"
#include "da.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
if (!createConnection())
return 1;
DA w;
w.show();
return a.exec();
}
-----------------Errors--------------

C:\Qt\4.3.3\include\QtSql/qsqltablemodel.h(37) : error C2144: syntax error : 'int' should be preceded by ';'
C:\Qt\4.3.3\include\QtSql/qsqltablemodel.h(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Qt\4.3.3\include\QtSql/qsqltablemodel.h(37) : error C2470: 'QSqlTableModel' : looks like a function definition, but there is no parameter list; skipping apparent body
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(53) : error C2504: 'QSqlTableModel' : base class undefined
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C2143: syntax error : missing ';' before '*'
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C2433: 'QSqlRelationalTableModel::QSqlTableModel' : 'virtual' not permitted on data declarations
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : warning C4183: 'relationModel': missing return type; assumed to be a member function returning 'int'
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(83) : error C2065: 'd_ptr' : undeclared identifier
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (52) : error C2065: 'QSqlTableModel' : undeclared identifier
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (52) : error C2065: 'childModel' : undeclared identifier
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (58) : error C2227: left of '->fieldIndex' must point to class/struct/union/generic type
type is ''unknown-type''
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (72) : fatal error C1903: unable to recover from previous error(s); stopping compilation

jpn
27th March 2008, 11:21
Is there an #endif directive at the end of connection.h?

Tavit
27th March 2008, 12:10
Hi,
I for got to copied that line.I have the line of code.please check the code once again..
Thank you for giving reply.




Regards,
Tavit.

jpn
27th March 2008, 12:16
Are you able to compile it with Qt Command Prompt?

Tavit
31st March 2008, 08:24
Hi,
Thank you for reply,i compiled in Qt command prompt.That time i am not getting any errors.Is it require Sqlite plugin???..in program i am not geetting any errors.while running the project i am getting errors following like...


error C2144: syntax error : 'int' should be preceded by ';'
C:\Qt\4.3.3\include\QtSql/qsqltablemodel.h(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Qt\4.3.3\include\QtSql/qsqltablemodel.h(37) : error C2470: 'QSqlTableModel' : looks like a function definition, but there is no parameter list; skipping apparent body
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(53) : error C2504: 'QSqlTableModel' : base class undefined
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C2143: syntax error : missing ';' before '*'
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C2433: 'QSqlRelationalTableModel::QSqlTableModel' : 'virtual' not permitted on data declarations
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : warning C4183: 'relationModel': missing return type; assumed to be a member function returning 'int'
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(83) : error C2065: 'd_ptr' : undeclared identifier
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (52) : error C2065: 'QSqlTableModel' : undeclared identifier
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (52) : error C2065: 'childModel' : undeclared identifier
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (58) : error C2227: left of '->fieldIndex' must point to class/struct/union/generic type
type is ''unknown-type''
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (72) : fatal error C1903: unable to recover from previous error(s); stopping compilation
dasdatabase.cpp
C:\Qt\4.3.3\include\QtSql/qsqltablemodel.h(37) : error C2144: syntax error : 'int' should be preceded by ';'
C:\Qt\4.3.3\include\QtSql/qsqltablemodel.h(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Qt\4.3.3\include\QtSql/qsqltablemodel.h(37) : error C2470: 'QSqlTableModel' : looks like a function definition, but there is no parameter list; skipping apparent body
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(53) : error C2504: 'QSqlTableModel' : base class undefined
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C2143: syntax error : missing ';' before '*'
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C2433: 'QSqlRelationalTableModel::QSqlTableModel' : 'virtual' not permitted on data declarations
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(71) : warning C4183: 'relationModel': missing return type; assumed to be a member function returning 'int'
C:\Qt\4.3.3\include\QtSql/qsqlrelationaltablemodel.h(83) : error C2065: 'd_ptr' : undeclared identifier
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (52) : error C2065: 'QSqlTableModel' : undeclared identifier
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (52) : error C2065: 'childModel' : undeclared identifier
c:\qt\4.3.3\include\qtsql\qsqlrelationaldelegate.h (58) : error C2227: left of '->fieldIndex' must point to class/struct/union/generic type

could you help me...i am stuck with this problem..

jpn
31st March 2008, 08:40
.while running the project i am getting errors following like...
Huh? They are compilation errors.