开发者

Include QT file problem in Visual Studio 2008

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开发者_如何学Python VS2005 to VS2008, this was not the case in VS2005, and it started with VS2008. Why am I getting this error?


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜