gcc main.c -o main -I include
I am creating a small c application where my all source files are in src directory while all header files in include directory, also all common files are in common directory. All these three directories are under one directory named as "app" directory along with main.c. Now i am trying to run main.c which contains #include directive include header files from include and function calls to .c files in both common and src directories. I am using -I but it is useful only for one directory path indication. How do I tell compiler to look in both src common and include directories to resolve the calls. Kindly suggest me a command or make file to include path of multiple directories while compiling with gcc.
Multiple
-I
options are permitted. The description of the-I
option from Options for Directory Search states:For example:
Note that if
main.c
is using functions implemented in another.c
file(s) then the other.c
files will also need compiled and linked into the final program binary. For example: