Hi everyone,
When writing a program (say, work.c), I could simply include header
files using, for example:
#include <stdio.h>
and "gcc work.c" would compile no problem.
For the compiler such as gcc, how does it know where to find that
include file, without even having to specify paths to search using -I ?
I'd certainly think it has internally included (default) path to
/usr/include/ ? It also seems to be the case for arm-linu-gcc (cross
compiler for arm processor). What if I do not want use those header
files in my native system but the others (ie. the ones that come with
arm cross compiler package)?
In addition, if two included paths both contain the header needed (same
name but not necessary the same content). Which one does a compiler choose?
I never have understood this concept until recent I started working with
different compiler for different platform which has its own libraries
and different versions of linux kernels. And I'd get confused with
different versions of header files in my system.
I'd really appreciate if anyone could answer these questions for me.
Thanks alot!
Johnny