Header file declaration differences

Hi all,

I have been confused about this for a long time now.. What is the difference between double quotation marks and inequality brackets when including a header file? I believe the double quotation marks are used when the header file is located in the same directory, correct me if I'm wrong. Also, How does the compiler know where to find the header files if the path is not specified? Thanks in advance for the clarification!

-Ian
Here is what I mean:

include "header.h" VS. include <header.h>
I believe the double quotation marks are used when the header file is located in the same directory, correct me if I'm wrong

That's correct. And you use <> when the file is located in one of the include paths. By default this is /usr/include or /path/to/your/compiler/include on Windows. But you can add more if necessary.
Angle brackets (<>) tell the compiler to search the system include path first.
Double quotes ("") tell the compiler to search the user-specified include path first.

In general you use double quotes for headers you write and angle brackets for headers
that are part of 3rd party libraries / compiler libraries / etc.
When using angle brackets, the compiler will only search the include paths, not the current directory.
I see.. thanks guys :)

-Ian
Topic archived. No new replies allowed.