As you gave little information about the error and what kind of development environment you are using, the following thing could be an issue if you are not using .pro files. If you are actually using .pro files this might not be relevant for you:
If you are using e.g. Visual Studio rather than Qt Project files and you only include $(QTDIR)\include, then you will have to write
#include <QtCore/QObject>
#include <QtGui/QWidget>
and so on. This is because Qt's include directory has the files in subfolders "QtCore", "QtGui" etc.
If you don't want to add the QtCore or QtGui or whatever in your includes, you would have to include $(QTDIR)\include\QtCore, $(QTDIR)\include\QtGui etc
(Note that I'm not 100% sure about the include path, can't look it up on this machine)