Results 1 to 6 of 6

Thread: Sql concept error solving

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Posts
    52
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default 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-----------------------------
    Qt Code:
    1. #ifndef CONNECTION_H
    2. #define CONNECTION_H
    3.  
    4. #include <QMessageBox>
    5. #include <QSqlDatabase>
    6.  
    7. inline bool createConnection()
    8. {
    9. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    10. db.setDatabaseName(":memory:");
    11. if (!db.open()) {
    12. QMessageBox::warning(0, QObject::tr("Database Error"),
    13. db.lastError().text());
    14. return false;
    15. }
    16. return true;
    17. }/*
    To copy to clipboard, switch view to plain text mode 
    ------------------main.cpp-------------------
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtSql>
    3. #include "connection.h"
    4. #include "da.h"
    5.  
    6. int main(int argc, char *argv[])
    7. {
    8. QApplication a(argc, argv);
    9. if (!createConnection())
    10. return 1;
    11. DA w;
    12. w.show();
    13. return a.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 
    -----------------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
    Last edited by jpn; 27th March 2008 at 10:19. Reason: missing tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Sql concept error solving

    Is there an #endif directive at the end of connection.h?
    J-P Nurmi

  3. #3
    Join Date
    Mar 2008
    Posts
    52
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default 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.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Sql concept error solving

    Are you able to compile it with Qt Command Prompt?
    J-P Nurmi

  5. #5
    Join Date
    Mar 2008
    Posts
    52
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default 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...

    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..
    Last edited by jpn; 31st March 2008 at 07:40. Reason: missing [quote] tags

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Sql concept error solving

    Quote Originally Posted by Tavit View Post
    .while running the project i am getting errors following like...
    Huh? They are compilation errors.
    J-P Nurmi

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.