openfrog
openfrog

Reputation: 40765

What's the difference between these imports?

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?

Upvotes: 1

Views: 173

Answers (2)

Andrew Rollings
Andrew Rollings

Reputation: 14571

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

Upvotes: 5

dsolimano
dsolimano

Reputation: 9006

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++

Upvotes: 1

Related Questions