here is a typical pattern, and it may depend on your compiler what is available to you... you have 2 types of include path during compilation:
- User Header search path, denoted by double quoted
#include "header.h"
header names, these are typically just for the project that you are working on; as in you wouldn't address library headers this way typically.
- System Header search path, denoted by angle braces
#include <mylib/header.h>
, this can also be used for your libraries...
lets imagine the following simple scenario...
Project A depends on Lib A.
in lib_a we have one c file and 2 headers...
lib_a.c
, lib_a.h
, and lib_a_internal.h
when you build lib_a.c you use the following includes:
#include "lib_a.h"
#include "lib_a_internal.h"
in your build script you will copy lib_a.h
to include/lib_a/lib_a.h
somewhere in your system headers path (maybe not in your real system headers, but a build specific one, depending on how atomic and sophisticated you want to be.)
You would also likely copy your lib_a.a
(or .so
or .dyld
, or .dll
) to lib/lib_a.a
where lib
is typically a peer of include
above.
then when you build Project A you use the following:
#include <lib_a/lib_a.h>