Sql concept error solving
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-----------------------------
Code:
#ifndef CONNECTION_H
#define CONNECTION_H
#include <QMessageBox>
#include <QSqlDatabase>
inline bool createConnection()
{
db.setDatabaseName(":memory:");
if (!db.open()) {
db.lastError().text());
return false;
}
return true;
}/*
------------------main.cpp-------------------
Code:
#include <QtGui/QApplication>
#include <QtSql>
#include "connection.h"
#include "da.h"
int main(int argc, char *argv[])
{
if (!createConnection())
return 1;
DA w;
w.show();
return a.exec();
}
-----------------Errors--------------
Quote:
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
Re: Sql concept error solving
Is there an #endif directive at the end of connection.h?
Re: Sql concept error solving
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.
Re: Sql concept error solving
Are you able to compile it with Qt Command Prompt?
Re: Sql concept error solving
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...
Quote:
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..
Re: Sql concept error solving
Quote:
Originally Posted by
Tavit
.while running the project i am getting errors following like...
Huh? They are compilation errors.