3

Possible Duplicate:
Obj C - #import < > and “ ”

This may be a simple question, but googling it is difficult. What's the difference between following two statements?

#import "GrowlDisplayPlugin.h"
#import <GrowlDisplayPlugin.h>

They work in different ways for me, so I thought it's about time I understand what I'm doing.

In particular, the second one says 'No such file or directory' and the first one following linking error.

Undefined symbols:
  "_OBJC_METACLASS_$_GrowlDisplayPlugin"

Thank you

Community
  • 1
  • 1
Nikita Rybak
  • 67,365
  • 22
  • 157
  • 181
  • possible duplicate of [Obj C - #import < > and " "](http://stackoverflow.com/questions/1044360/obj-c-import-and), my Google terms were "angle bracket import objective-c" – BoltClock Feb 06 '11 at 22:30
  • About that linking error: it can only one have one cause: wrong linking. Framework or library? Shared or static library? User or application framework? – v1Axvw Feb 06 '11 at 22:38
  • @Ief2 I'm just trying to replicate structure of Display Plugin Sample [here](http://growl.info/downloads_developers.php) . They have local header files without implementation, but refer them with `<..>` – Nikita Rybak Feb 06 '11 at 22:46

3 Answers3

9

" are used for local files. That means files in the current directory or in directories specified by the -iqoute flag for the GCC compiler.

< and > are used for system files found in the folders of your path. /usr/include is probably one of them. The -I flag can be used to specify more directories to search when looking for those files.

v1Axvw
  • 3,054
  • 3
  • 26
  • 40
5

Using <> imports from the library search paths. Using "" imports the file from your user search paths (usually just the directory containing your project)

jakev
  • 2,815
  • 3
  • 26
  • 39
  • 3
    How exactly do you set library search path in xcode? I've seen many projects referring with `<..>` to local files. – Nikita Rybak Feb 06 '11 at 22:44
2

The difference is in the order, in which the compiler searches different folders for files. The "fine.h" form gives precedence to the current folder (the one where the containing source file is). The <> form searches the system include folder first.

Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281