开发者

difference between "file.h" and <file.h> import statements [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Obj C - #import < > and “ &rdqu开发者_JAVA百科o;

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


" 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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜