What is difference between the following syntax:
#include <filename.h>
#include "filename.h"
When to use each of the above?

File inclusion can be done in the following 2 ways:
#include <filename.h>
#include "filename.h"
Each of the format specifies the path to 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>. gcc looks at:
libdir/../include/c++/version
/usr/local/include
libdir/gcc/target/version/include
/usr/target/include
/usr/include
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.
0 Response on this
click to Post
Login to comment.
Why create separate log in id? Log in with your
log in with your google account to post comment
Leave your comment:
*
*
Post