Results 1 to 2 of 2

Thread: error: ISO C++ forbids declaration of '' with no type

  1. #1
    Join Date
    Jul 2012
    Posts
    25
    Thanks
    10

    Default error: ISO C++ forbids declaration of '' with no type

    Hi,
    I'm new to Qt. I've just tried to make a program containing empty Combobox in GroupBox (I've tride to combine some example programs) but I have a problem with error:ISO C++ forbids declaration of 'OZ' with no type (nw.h 12). I'm sure that's beginner's mistake but I can't work it out. Here is my code:

    main.cpp
    Qt Code:
    1. #include <QApplication>
    2. #include "nw.h"
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication app(argc, argv);
    6. NW asd;
    7. asd.show();
    8. return app.exec();
    9. }
    To copy to clipboard, switch view to plain text mode 


    nw.h
    Qt Code:
    1. #ifndef NW_H
    2. #define NW_H
    3. #endif
    4. #include <QWidget>
    5. QT_BEGIN_NAMESPACE
    6. class QGroupBox;
    7. QT_END_NAMESPACE
    8. class NW : public QWidget
    9. {
    10. Q_OBJECT
    11. public:
    12. NW(QWidget *parent = 0);
    13. private:
    14. QGroupBox *WA();
    15. };
    To copy to clipboard, switch view to plain text mode 

    nw.cpp
    Qt Code:
    1. #include <QtGui>
    2. #include "nw.h"
    3. NW::NW (QWidget *parent)
    4. : QWidget(parent)
    5. {
    6. QGridLayout *grid = new QGridLayout;
    7. grid->addWidget(Choose(), 0, 0);
    8. setLayout(grid);
    9. setWindowTitle(tr("Add new"));
    10. resize(480, 320);
    11. }
    12. QGroupBox *WA()
    13. {
    14. QGroupBox *groupBox = new QGroupBox(tr("New"));
    15. return groupBox;
    16. }
    To copy to clipboard, switch view to plain text mode 

    Thanks for help
    Last edited by Pawello; 21st July 2012 at 21:37. Reason: updated contents

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: error: ISO C++ forbids declaration of '' with no type

    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. error ISO C++ forbids declaration of 'obj' with no type
    By naturalpsychic in forum Qt Programming
    Replies: 1
    Last Post: 26th January 2011, 06:23
  2. Replies: 2
    Last Post: 10th October 2010, 16:38
  3. Replies: 13
    Last Post: 31st July 2010, 15:19
  4. Replies: 12
    Last Post: 29th April 2010, 13:22
  5. forbids declaration of QHash with no type
    By nina1983 in forum Qt Programming
    Replies: 4
    Last Post: 16th July 2008, 13:05

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.