Dumb question, but when you include a header file in a C program, how does the compiler/program know where to find the source file?
Dumb question, but when you include a header file in a C program, how does the compiler/program know where to find the source file?
1. Config files, or the registry
2. Hard coded into the compiler
3. User defined (or environment variables).
Usually, the compiler will have a list of places it will go through in order to find the header. For example,
1. Where you tell it to look
2. /usr/include
3. /path/to/my/program
By source file, I meant the *.c file. If I specify foo.h, does the compiler/program look for foo.c in the same location as foo.h?
if you use "" - then compiler start from the current folder, then it goes all the include path
then you use <> - it skips the current folder and starts with the include path scanning directly
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler