What is the difference between #include and #include “filename”?

What differs is the locations in which the preprocessor searches for the file to be included.

  • #include <filename>   The preprocessor searches in an implementation-defined manner, normally in directories pre-designated by the compiler/IDE. This method is normally used to include header files for the C standard library and other header files associated with the target platform.

  • #include "filename"   The preprocessor also searches in an implementation-defined manner, but one that is normally used to include programmer-defined header files and typically includes same directory as the file containing the directive (unless an absolute path is given).

For GCC, a more complete description is available in the GCC documentation on search paths.

Leave a Comment