Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Subfolder Organization
Qt 6.11 is out! See what's new in the release blog

Subfolder Organization

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kuraudo
    wrote on last edited by
    #1

    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:

    feather.pro:

    @QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = feather
    TEMPLATE = app

    include(gui/gui.pri)

    SOURCES += main.cpp@

    main.cpp:

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

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

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

    }@

    gui/gui.pri:

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

    gui/mainwindow.h

    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();
    };

    #endif // MAINWINDOW_H@

    gui/mainwindow.cpp

    @#include "mainwindow.h"

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

    MainWindow::~MainWindow()
    {
    }@

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

    bq. Error: dependent '..\feather\mainwindow.h' does not exist. jom:
    C:\Users\Zac\Dev\Qt\build-feather-Desktop_Qt_5_1_1_MSVC2012_32bit-Debug\Makefile
    [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 feather.pro:

    @QT += core gui

    greaterThan(QT_MAJOR_VERSIN, 4): QT += widgets

    TARGET = feather
    TEMPLATE = app

    SOURCES += main.cpp
    gui/mainwindow.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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      you should add this line in .pro file

      @
      INCLUDEPATH += gui
      @

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved