views:

46

answers:

2

For example, sometimes there's an import like this:

#import <Cocoa/Cocoa.h>

and sometimes the import looks like this:

#import "Foo.h"

Now what's the difference there? The first is in < > tag things, and the second is in doublequotes. What does the first do? Is that used for pre-compiled files like frameworks which are compiled already? Or what's the point there?

+4  A: 

The angle brackets indicate system includes (which looks in a different set of directories).

The double-quoted include is for non-system includes... (i.e. yours). It will look in the current directory first, and then other (command line specified) include directories.

There's a pretty good set of documentation here:

http://developer.apple.com/mac/library/documentation/DeveloperTools/gcc-4.0.1/cpp/Header-Files.html

Andrew Rollings
+1  A: 

The general idea is that the angle bracket form looks in your path and in your lib and in any additional include directories that you tell it, while the quote form looks relative to the including file.

EG for Visual C++

dsolimano