While QApplication
and QButton
are part of the Qt GUI module, QString
is part of the Qt Core module. GUI depends on Core, so the Core library is already linked, that's not the problem.
The problem seems that your include path only includes the Qt top level as well as the GUI sub-directory. Qt's header files are structured in modules, one directory for each module. This means that the <QApplication>
and <QButton>
headers are in ../qt4/qt4GUI
and can thus be found by the compiler.
However, QString
is placed in ../qt4/qt4Core
(1) and thus has either be included as #include <QtCore/QString>
(2) which will look in the correct module sub-directory, or by adding the sub-directory to your include paths in the project configuration (recommended), so #include <QString>
works too.
(1) I think this should be ../qt4/QtCore
, and for Qt GUI ../qt4/QtGui
, but you wrote something different in the question...
(2) Iternally in Qt, classes of other modules are included like this, i.e. relative to the Qt top level include path, so if you include a class which uses QString
(QApplication
being one example), it's working without adding another include.