PDA

View Full Version : #include <QtGui/QDesktopWidget> no such file or directory



saman_artorious
23rd February 2013, 12:28
i am running a qt 4.7 embedded widget program in qt 5.
i get the following errors with headers:

#include <QtGui/QDesktopWidget>
#include <QtGui/QAbstractButton>

how can i solve it?

amleto
23rd February 2013, 14:08
"I am running a qt 4.7 embedded widget program in qt 5."
I don't understand.



i get the following errors with headers:

#include <QtGui/QDesktopWidget>
#include <QtGui/QAbstractButton>

What errors?

Do you mean you have some code written using qt4.7 and now you want to compile it with qt5? If so, google "porting qt4 to qt5".

anda_skoa
23rd February 2013, 16:59
In short:

remove the module name from the includes


#include <QDesktopWidget>


add


QT += widgets

to the .pro file

You can make the second change depend on the version of Qt you are building with, the first change works for both Qt4 and Qt5

Cheers,
_

d_stranz
23rd February 2013, 18:20
#include <QtGui/QDesktopWidget>
#include <QtGui/QAbstractButton>

how can i solve it?

@saman_artorious: Did you bother to read the almost identical reply to the almost identical question you asked two days ago? The solution you need is posted in both places. Next time you get a similar compilation error, think about how similar it might be to these two cases before posting the same question a third time.

saman_artorious
24th February 2013, 09:41
@saman_artorious: Did you bother to read the almost identical reply to the almost identical question you asked two days ago? The solution you need is posted in both places. Next time you get a similar compilation error, think about how similar it might be to these two cases before posting the same question a third time.

:D you are right d_stranz. I was pretty confused yesterday, was away from this community n qt programming for a while n ended up with installing qt 5 n getting some bugs.
anyway, it is nice to see your profile image after a few months.

d_stranz
24th February 2013, 19:13
#include <QtGui/QDesktopWidget>
#include <QtGui/QAbstractButton>


I guess I never see this problem, because I have never used the "QtGui/" qualifier. I always simply do this:



#include <QDesktopWidget>
#include <QAbstractButton>


and adjust the include paths in the project settings.