All of a project's header files should be listed as descendants of the project's source directory without use of UNIX directory shortcuts(the current directory) or
.(the parent directory).
So what should I do to include it without using '.' or '..' ?
You need to decide on whether to use just the base name of the header file (
a.h in your question's abbreviated example), or whether to use a subdirectory plus header name
project/a.h). Either is workable as long as the header names are unique; the subdirectory version is often better and requires fewer command line options, in general.
You can write:
#ifndef B_H_INCLUDED #define B_H_INCLUDED #include "utility/a.h" …other material required… #endif /* B_H_INCLUDED */
and then, on the compiler command line, include an option:
This ensures that the compiler will find
../utility/a.h (unless there's a name conflict somewhere). Or you can specify the absolute path to your project:
which will read