c++ - Qt include header file from above directory -
at first, don't think become problem, after few day working it, still can't find solution
source | |--- model | | | | - a.h |-b.h
i can't include b.h a.h, compiler complain
"cannot open include 'b.' : no such file or directory
and .pro file
template = app qt += qml quick widgets sql qt += declarative resources += qml.qrc include(deployment.pri) headers += \ sources/b.h \ sources/model/a.h
a.h
#ifndef a_h #define a_h #include "source/b.h" class { }; #endif
b.h
#ifndef b_h #define b_h class b { }; #endif
how can fix this? , thank dropping by
the path include file relative source file including it. here in a.h
should have :
#include "../b.h"
or add path include directories adding .pro
:
includepath += $$pwd/source
and include header file like:
#include "b.h"
Comments
Post a Comment