What is difference between the following syntax: #include <filename.h> #include "filename.h" When to use each of the above?
How to include header files?
File inclusion can be done in the following 2 ways:
Each of the format specifies the path for the compiler to look for inclusion file filename.h
All standard header file like iostream, stdio.h are located in a standard path and they should be included as #include <filename.h>.
On Linux, gcc looks at: libdir/../include/c++/version
All project specific user defined header files should be included in #include "filename.h" . Compiler now looks into same folder where the file being compiled is present, then at paths specified for compile option -iquote and then -I and then in above mentioned standard paths.