I have a project which has the following directory structure.
root
--include
----module1
----module2
--src
----module1
----module2
So a file say foo.cpp in src/module1 has to include like,
#include "../../include/module1/foo.hpp"
This looks messy and tough to write. I found writing include like
#include <module1/foo.h>
and providing include file search path to root/include when compiling looks neat. However, I am not sure that this style has got any drawbacks.
Which one do you prefer and why? Also do you see any problems in organizing files in the above way?
Specifying paths should be avoided as much as possible. Compilers provide you with a cleaner alternative to achieve the same. Further, a clean design should see to it that you do not need to juggle relative paths for including headers.
A better idea of which one to use (including whether to use quotes or the angle-brackets)
can be had from the standard.
From my copy of the C++ draft: