[Qt-interest] [newbie] invalid use of incomplete type ‘struct Ui::NN’
Wojciech Waśko
wojciechwasko at gmail.com
Thu Oct 29 00:32:47 CET 2009
Hi,
It's my first try with Qt and I'm trying to write a simple program which
would import a text file and do some stuff with its content. Whatever.
Anyway, I'm stuck on the following error(s):
(...)/main.cpp:24: error: invalid use of incomplete type ‘struct Ui::NN’
and
(...)/nn.h:8: error: forward declaration of ‘struct Ui::NN’
I've been googling for about an hour now and can't find anything related.
Here are my files:
*-------------> main.cpp*
#include <QtGui/QApplication>
#include <QtCore/QFile>
#include <QtCore/QTextStream>
#include "nn.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
NN w;
w.show();
return a.exec();
}
void NN::loadTextFile()
{
QFile inputFile(":/input.txt");
inputFile.open(QIODevice::ReadOnly);
QTextStream in(&inputFile);
QString line;
while (!in.atEnd())
{
line = in.readLine();
ui->textEdit->setPlainText(line);
}
inputFile.close();
}
-------------> end main.cpp
*-------------> nn.cpp*
#include "nn.h"
#include "ui_nn.h"
NN::NN(QMainWindow *parent)
: QMainWindow(parent), ui(new Ui::NN)
{
ui->setupUi(this);
loadTextFile();
}
NN::~NN()
{
delete ui;
}
-------------> end nn.cpp
*-------------> nn.h*
#ifndef NN_H
#define NN_H
#include <QtGui/QMainWindow>
namespace Ui
{
class NN;
}
class NN : public QMainWindow
{
Q_OBJECT
public:
NN(QWidget *parent = 0);
~NN();
private:
Ui::NN *ui;
void loadTextFile();
};
#endif // NN_H
-------------> end nn.h
Help, anybody?
dare2be
--
Wojciech Waśko,
wojciechwasko at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091029/644ad3b0/attachment.html
More information about the Qt-interest-old
mailing list