[Qt-interest] relative address in #include header file
jjDaNiMoTh
jjdanimoth at gmail.com
Sat Oct 31 17:04:17 CET 2009
2009/10/31 navid navid <n_nnavid at yahoo.com>:
> hello,
>
> sorry for this simple question!
>
> how can i include a header file in two up folders, with relative addressing?
>
> projectfolder/subfolder1/subfolder2/example.cpp
>
> #include "example.h" //work good
> #include "/subfolder2.h"
> #include "subfolder1.h" //???
> #include "projectfolder.h" //???
>
Assuming you're using GCC, see this [1] , explain this and a lot more.
But I think that you use QMake, that give a lot of help with these
situations, see [2].
So, don't use "../blabla.h" or "../../subdir/bla.h", instead use
"blabla.h" and "bla.h" and set INCLUDEPATH += ../ ../../subdir
salut
[1] http://www.network-theory.co.uk/docs/gccintro/gccintro_22.html
[2] http://qt.nokia.com/doc/4.5/qmake-variable-reference.html#includepath
More information about the Qt-interest-old
mailing list