Results 1 to 6 of 6

Thread: Class Confusion

  1. #1
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Class Confusion

    Qt Code:
    1. #ifndef CALENDARTIME_H
    2. #define CALENDARTIME_H
    3.  
    4. #include <QWidget>
    5. #include "ui_calendar-time.h"
    6.  
    7.  
    8. class CT : public QWidget, public Ui::Calendar-Time
    9. {
    10. Q_OBJECT
    11. public:
    12. CT(CT *parent = 0);
    13. ~CT();
    14. void setColumnRange(QChar first, QChar last);
    15.  
    16.  
    17. };
    18.  
    19. #endif // CALENDARTIME_H
    20.  
    21.  
    22. #include <QtGui/QApplication>
    23. #include "calendar-time.h"
    24.  
    25. int main(int argc, char *argv[])
    26. {
    27. QApplication a(argc, argv);
    28. CT w;
    29. CT.show();
    30. return a.exec();
    31. }
    To copy to clipboard, switch view to plain text mode 

    These are the errors:
    calendar-time.h:8: error: expected class-name before '-' token
    calendar-time.h:8: error: expected '{' before '-' token
    calendar-time.h:8: error: expected unqualified-id before '-' token
    mingw32-make[1]: *** [debug/main.o] Error 1

    I tried a qmake it doesn't help. I seem to always get this problem. :confused








    [/CODE]
    Last edited by Petr_Kropotkin; 23rd January 2010 at 00:08.

  2. #2
    Join Date
    Apr 2009
    Posts
    46
    Thanks
    4
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Class Confusion

    You can't use '-' character in names of variables, classes, objects. Use '_' instead.

  3. #3
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Class Confusion

    I did that and got these errors
    In file included from main.cpp:2:
    calendartime.h:8: error: expected '{' before 'public'
    calendartime.h:8: error: expected unqualified-id before 'public'

    I seem to hit this errors alot. I drives me nuts

  4. #4
    Join Date
    Dec 2009
    Location
    Shenzhen,China
    Posts
    21
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Class Confusion

    Maybe the problem is in line 12

    CT(CT *parent = 0);

    the parameter is wrong.

  5. #5
    Join Date
    Sep 2009
    Posts
    72
    Thanked 10 Times in 10 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: Class Confusion

    Hi

    It seems lost of correction are required during design of this class.

    First please check public Ui::Calendar-Time is correct. i.e. name space name

  6. #6
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Class Confusion

    Here is the namespace.
    I changed it from Calendar-Time to CalendarTime

    namespace Ui {
    class CTDialog: public Ui_CalendarTime{};
    } //
    Last edited by Petr_Kropotkin; 23rd January 2010 at 15:29.

Similar Threads

  1. Replies: 3
    Last Post: 27th December 2008, 19:34
  2. Templates Confusion
    By baray98 in forum General Programming
    Replies: 6
    Last Post: 23rd November 2008, 11:14
  3. QT debug confusion
    By swistak in forum Installation and Deployment
    Replies: 2
    Last Post: 24th September 2008, 19:25
  4. Replies: 3
    Last Post: 16th May 2007, 11:07
  5. QProgressBar confusion
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 23rd November 2006, 09:20

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.