PDA

View Full Version : error: ISO C++ forbids declaration of '' with no type



Pawello
21st July 2012, 21:24
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

#include <QApplication>
#include "nw.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
NW asd;
asd.show();
return app.exec();
}


nw.h

#ifndef NW_H
#define NW_H
#endif
#include <QWidget>
QT_BEGIN_NAMESPACE
class QGroupBox;
QT_END_NAMESPACE
class NW : public QWidget
{
Q_OBJECT
public:
NW(QWidget *parent = 0);
private:
QGroupBox *WA();
};

nw.cpp

#include <QtGui>
#include "nw.h"
NW::NW (QWidget *parent)
: QWidget(parent)
{
QGridLayout *grid = new QGridLayout;
grid->addWidget(Choose(), 0, 0);
setLayout(grid);
setWindowTitle(tr("Add new"));
resize(480, 320);
}
QGroupBox *WA()
{
QGroupBox *groupBox = new QGroupBox(tr("New"));
return groupBox;
}

Thanks for help

amleto
21st July 2012, 22:36
already answered elsewhere.
http://www.qtforum.org/article/38256/problem-with-iso-c-forbids-declaration.html#post119885