error:invalid use of undefined type 'struct QWorkspace'
hi,
idk if somebody has tried this before, but I had first time opportunity to use Qworkspace API in my program and the compiler is throwing out this puzzling error each time::
error:invalid use of undefined type 'struct QWorkspace'
I've included the required QWorkspace header file properly in my header file, but still I'm getting this error, code snippets are as follows:
Header file snippet is::
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
{
Q_OBJECT
public:
MainWindow();
private:
};
#endif
CPP file snippet is ::
Code:
#include <QtGui>
#include "test.h"
MainWindow::MainWindow()
{
setCentralWidget(workspace);
/*some stupid code of application*/
}
is there anything I'm missing out in that?
Thanks
Re: error:invalid use of undefined type 'struct QWorkspace'
Are you sure this is exactly the same code you were compiling? It's just that I can't see anything syntactically wrong and the includes sure are sufficient...
Re: error:invalid use of undefined type 'struct QWorkspace'
The following code which is infact the above classes put in a single file compiles and executes just fine on my system.
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
{
Q_OBJECT
public:
MainWindow();
private:
};
#endif
#include <QtGui>
MainWindow::MainWindow()
{
setCentralWidget(workspace);
/*some stupid code of application*/
}
int main(int argc, char **argv)
{
MainWindow mw;
mw.show();
return app.exec();
}
#include "main.moc"
Re: error:invalid use of undefined type 'struct QWorkspace'
Thanks jpn and momesana for your quick and helpful replies.
Actually it worked out later on, i don't know what was the problem initially when I was compiling it, but it got compiled well, after giving it second shot.
I guess may be there was linking libraries problem with the Makefile I created on my own >:<
Thanks and Regards
Re: error:invalid use of undefined type 'struct QWorkspace'
Quote:
Originally Posted by
LiCodeX
I guess may be there was linking libraries problem with the Makefile I created on my own
Wow, does somebody still write makefiles by hand these days. Why not use qmake which would do it for you? :)
Re: error:invalid use of undefined type 'struct QWorkspace'
Quote:
Originally Posted by
jpn
Wow, does somebody still write makefiles by hand these days. Why not use qmake which would do it for you? :)
:o yeah it was unnecessary futile attempt to get it done on my own.
sometimes getting word done by easy utility bothers me a bit :p
Thanks