Conditional include for nested header

I am running into an issue with a conditional include for a sub directory header. The structure is as follows:

project/
    include/foo.h
    src/
        baz.h
        foo.c
        modules/bar/bar.h

foo.c has the following import:

...
#ifdef ENABLE_MODULE_BAR
#include "modules/bar/bar.h"
#endif

bar.h has the following import:

...
#include "baz.h" /* <--- causing error */
...

So the issue I am having is that the compiler is unable to find “baz.h” as it appears I’d imagine is performing a relative search relative to “modules/bar” rather than underneath “src/”. Does anyone have a way to tackle this?

C and C++ includes don’t inherit search directories. When baz.h is included from bar.h, it’s going to search beside baz.h, not the file that included baz.h. You can add project/src to the include search path explicitly though.