18

I'm using Qt Creator, and this line is generated automatically by the Qt Creator:

#include <QtGui/QApplication>

But, why am I getting this message?

QtGui/QApplication: No such file or directory

6
  • Did you set the environment variable for the qt dir? Commented Apr 4, 2011 at 7:29
  • @Exa. I have added this to my PATH: C:\Qt\2010.05\bin. And, when I go to: Tools ---> Options... ---> Qt4 in the Qt Creator in the Qt versions tab under Auto-detected it says Qt in PATH <not found>. What should I do in this case? Commented Apr 4, 2011 at 7:35
  • didn't you forget to add QT += gui into your .pro file ? Commented Apr 4, 2011 at 7:49
  • @Kamil Klimek. I have done that, but the same remains Commented Apr 4, 2011 at 8:07
  • Those are the errors that I get: The Qt version is invalid: Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong? & The qmake command "<not found>" was not found or is not executable. Commented Apr 4, 2011 at 8:08

5 Answers 5

21

Depending on the Qt-version (5) QtGui was moved to QtWidgets; so it becomes

#include <QtWidgets/QApplication>
Sign up to request clarification or add additional context in comments.

Comments

14

You can try to add 'declarative' to the Project file:

QT += gui declarative

then

#include <QApplication>

It helps me

Comments

7

Issue solved.

I added this to PATH: C:\Qt\2010.05\qt\bin

Instead of: C:\Qt\2010.05\bin

As the latter didn't contain qmake.exe

Comments

5

This is a version problem.to fix,

  • you need to add QT += widgets in the .pro file
  • and run qmake

  • and also use #include <QApplication> instead of #include <QtGui/QApplication>

Comments

2

I had got same problem. From visual studio using Command Prompt(2010), I changed the path of prompt to where my Qt resides i.e. C:\Qt. There I set QTDIR environment variable.

c:\Qt> setx QTDIR C:\Qt

Then message was displayed:

SUCCESS: Specified value was saved.

Make sure VS is closed during this. When you reopen it, all headers will be detected.

I hope my solution will help anyone someday. Cheers :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.