I will vote for version 2.
#include "../lib1/lib1.h"
This assumes that the tree will always remain unchanged. Therefore, when you change your structure, you need to change it everywhere.
#include "lib1/lib1.h"
I do not see the problem of adding src to the include path. In fact, you donโt even need to add src to the include path, you can directly add src / lib1 and just have #include "lib1.h"
#include <lib1/lib1.h> // 3
This include style is used for system headers. You should avoid this, as most programmers are used to view windows.h
or string
or vector
inside <>
. You also tell the compiler to first look for those headers in the default directories, and not your own. I would avoid this.
Side note:
You should think of such a structure:
src +-- lib1 +-- lib1.h +-- lib2 +-- lib2.h include
where the include
directory contains all the public headers. If lib1.h
is public, move it there. If not, the structure you are currently using should be fine.
Luchian grigore
source share