Important: Please read the Qt Code of Conduct -

Subfolder Organization

  • I've reviewed several similar questions and their answers and nothing I've tried thus far has worked.

    I'm starting a Qt project that will be quite large in scope. To keep things better organized, I intend on utilizing subdirectories within my Qt project. Things are not off to a good start.

    I am using: Qt Creator 2.8.1 based on Qt 5.1.1

    Here is what I've come up with based on previous answers I've seen:

    @QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = feather
    TEMPLATE = app


    SOURCES += main.cpp@


    @#include <QApplication>
    #include "gui/mainwindow.h"

    int main(int argc, char *argv[])
    QApplication a(argc, argv);
    MainWindow w;;

    return a.exec&#40;&#41;;



    @SOURCES += gui/mainwindow.cpp
    HEADERS += gui/mainwindow.h@


    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>

    class MainWindow : public QMainWindow

    MainWindow(QWidget *parent = 0);

    #endif // MAINWINDOW_H@


    @#include "mainwindow.h"

    MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)


    This is about as barebones as it gets. The error received is:

    bq. Error: dependent '..\feather\mainwindow.h' does not exist. jom:
    [debug] Error 2 16:12:50: The process
    "C:\Qt\Qt5.1.1\Tools\QtCreator\bin\jom.exe" exited with code 2. Error
    while building/deploying project feather (kit: Desktop Qt 5.1.1
    MSVC2012 32bit) When executing step 'Make'

    The error is the same if I use the standard

    @QT += core gui

    greaterThan(QT_MAJOR_VERSIN, 4): QT += widgets

    TARGET = feather
    TEMPLATE = app

    SOURCES += main.cpp
    HEADERS += gui/mainwindow.h@

    I don't know why it's dependent on feather/mainwindow.h instead of feather/gui/mainwindow.h. Any advice?

  • Hi,

    you should add this line in .pro file

    INCLUDEPATH += gui

Log in to reply