views:

89

answers:

3

Don't understand why #include <Header.h> is not compiling while #include "Header.h" is compiling with Visual Studio 2008. Am I missing something?

+5  A: 

The two forms of #include search for headers differently.

You can find which paths are searched for each form in the #include MSDN documentation.

James McNellis
+2  A: 

when you mention header file <>, it looks in standard includes, but when header file is included with "", starts with current directory,then will look at standard includes. Here, in this case, Header.h is in current directory, may not be in standard includes.

Koteswara sarma
+1 for trying to document the relevant behavioural difference, but "current directory" could easily be misunderstood. E.g. (not worded too well) it may initially be the "current working directory" from the compiler's perspective, but a header included from any directory can find other headers using a relative path in double quotes...
Tony
+3  A: 

They have different purposes.

The brackets < and > are for standard header files, while the quotes " are for your header files.

Here is another question with more information regarding this:

http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename

tster