change QCoreApplication to QApplication. - and the corresponding include as well.
change QCoreApplication to QApplication. - and the corresponding include as well.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Hi,
Thanks for quick reply, but the solution is not working for me !
now the code is changed to
Qt Code:
#include <QApplication> #include <QtGui\QLabel> int main(int argc, char *argv[]) { label.show(); return a.exec(); }To copy to clipboard, switch view to plain text mode
but i am getting the following errors:
main.cpp:1:24: error: QApplication: No such file or directory
main.cpp:6: error: variable 'QApplication a' has initializer but incomplete type
when I choolse "Qt Console Application", while creating new project, by default QtCreator includes QtCoreApplicaion. so is that wrong ?
-Pradeep-
#include <QtGui\QApplication>
No, QtCreator is doing it right.when I choolse "Qt Console Application", while creating new project, by default QtCreator includes QtCoreApplicaion. so is that wrong ?
But a console application by definition has no GUI. (I am not talking about ncourses style GUI).
Yet you are initializing gui elements in your code!
So either use GUI and make a GUI application, or a console one, without GUI.
But trying to use GUI elements in non GUI application wont work.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
prady (16th December 2010)
Yes I understand now, thank you.
but only adding #include <QtGui\QApplication> is not fixing my problem.
I have modified "QT -= gui" line in .pro file to "QT += gui" helps to solve those errors.
I assume this tells compiler to include gui libraries.
Thanks again,
Pradeep.
yes, that is correct.
In my first answer I was not aware you configured a console application.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Bookmarks