Including a header file from another directory

Solution 1:

When referencing to header files relative to your c file you should use #include "path/to/header.h"

The form #include <someheader.h> is only used for internal headers or for explicitly added directories (in gcc with the -I option).

Solution 2:

write

#include "../b/structure.h"

in place of

#include <structures.h>

then go in directory in c & compile your main.c with

gcc main.c

Solution 3:

If you work on a Makefile project or simply run your code from command line, use

gcc -IC main.c

where -I option adds your C directory to the list of directories to be searched for header files, so you'll be able to use #include "structures.h"anywhere in your project.