Cannot create a QWidget without QApplication
<p>When i compile my qt project showed below error?</p>

<pre><code>QWidget: Cannot create a QWidget without QApplication
</code></pre>

<p>What is the problem? </p>

<blockquote>
  <p>Main.cpp</p>
</blockquote>

<pre><code>#include&lt;QApplication&gt;
#include"MainWindow.h"

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    MainWindow w;
    w.show();
    return app.exec();
}
</code></pre>