views:

39

answers:

2

When I type

#include <QObject>

it complains that it couldn't find file.

but if I type

#include <QtCore\QObject>

It works properly.

I moved VS2005 to VS2008, this was not the case in VS2005, and it started with VS2008. Why am I getting this error?

+2  A: 

Actually it's not so big problem. You need to check you include directories and add (path_to_qt_headers)/QtCore, (path_to_qt_headers)/QtGui and directories for other modules you are using. According to your problem description you have added only (path_to_qt_headers) itself.

If Qt set up correctly both #include <QObject> and #include <QtCore/QObject> should work but second one works in more cases. I remember I saw some notice somewhere in the Qt documentation that it might be better to using second include style. At the same time this long include version is recommended in the KDE coding guidelines.

For myself I preffere to follow #include <QtModule/QClass> include convention

VestniK
Yes, it solved my problem. On the hand, it seems that I will use #include <QtCore/QObject> considering the best practices.
metdos
A: 

Maybe installing the Visual Studio addin for Qt would solve the problem (besides providing advanced debug and Qt project management tools).

gregseth
I already did that.
metdos