There was no need to change mainwindow.cpp, only the PRI file, and then you must rerun qmake.
Qt Code:
  1. //>>>>> feather.pro
  2.  
  3. QT += core gui
  4. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
  5. TARGET = feather
  6. TEMPLATE = app
  7. include(gui/gui.pri)
  8. SOURCES += main.cpp
  9.  
  10. //>>>>> main.cpp
  11.  
  12. #include <QApplication>
  13. #include "gui/mainwindow.h"
  14.  
  15. int main(int argc, char *argv[])
  16. {
  17. QApplication a(argc, argv);
  18. MainWindow w;
  19. w.show();
  20.  
  21. return a.exec();
  22. }
  23.  
  24. //>>>>> gui/gui.pri
  25.  
  26. INCLUDEPATH += gui
  27. DEPENDPATH += gui
  28. SOURCES += gui/mainwindow.cpp
  29. HEADERS += gui/mainwindow.h
  30.  
  31. //>>>>> gui/mainwindow.h
  32.  
  33. #ifndef MAINWINDOW_H
  34. #define MAINWINDOW_H
  35.  
  36. #include <QMainWindow>
  37.  
  38. class MainWindow : public QMainWindow
  39. {
  40. Q_OBJECT
  41.  
  42. public:
  43. MainWindow(QWidget *parent = 0);
  44. ~MainWindow();
  45. };
  46.  
  47. #endif // MAINWINDOW_H
  48.  
  49. //>>>>> gui/mainwindow.cpp
  50.  
  51. #include "mainwindow.h"
  52.  
  53. MainWindow::MainWindow(QWidget *parent)
  54. : QMainWindow(parent)
  55. {
  56. }
  57.  
  58. MainWindow::~MainWindow()
  59. {
  60. }
To copy to clipboard, switch view to plain text mode 
Works fine, even if you remove the "gui/" from the #include in main.cpp.