Hi. I'm trying to create project structure like below
test/
test.pro
build/
build.pro
main.cpp
gui/
gui.pro
mainwindow.h
mainwindow.cpp
My test.pro looks like this:
TEMPLATE = subdirs
SUBDIRS = gui
CONFIG += ordered
SUBDIRS +=build
build.pro
TEMPLATE = app
QT += core gui
SOURCES += main.cpp
LIBS += -L../gui
gui.pro
TEMPLATE = lib
SOURCES += \
mainwindow.cpp
HEADERS += \
mainwindow.h
mainwindow.cpp
#include "mainwindow.h"
MainWindow::MainWindow(){}
MainWindow::~MainWindow(){}
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
class MainWindow : public QMainWindow
{
public:
MainWindow();
~MainWindow();
};
#endif // MAINWINDOW_H
main.cpp
#include <QApplication>
#include "gui/mainwindow.h" //error
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//MainWindow w;
//w.show();
return a.exec();
}
I got an error during compilation:
../../test/build/main.cpp:2:25: error: gui/gui.h: No such file or directory
What am I doing wrong?