简体   繁体   English

这些进口之间有什么区别?

[英]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? 或那里有什么意义?

The angle brackets indicate system includes (which looks in a different set of directories). 尖括号表示系统包括(在一组不同的目录中查找)。

The double-quoted include is for non-system includes... (ie 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 http://developer.apple.com/mac/library/documentation/DeveloperTools/gcc-4.0.1/cpp/Header-Files.html

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. 一般的想法是尖括号形式出现在您的路径,lib中以及您告诉它的任何其他包含目录中,而引号形式则相对于包含文件而言。

EG for Visual C++ 用于Visual C ++的 EG

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CALayer -drawInContext:和-renderInContext之间的区别是什么? - What's the difference between CALayer -drawInContext: and -renderInContext:? glBindRenderbufferOES和glBindRenderbuffer有什么区别? - What's the difference between glBindRenderbufferOES and glBindRenderbuffer? Admob和Adwhirl有什么区别? - What's the difference between Admob and Adwhirl? XIB和NIB文件有什么区别? - What's the difference between a XIB and a NIB file? -objectRegisteredForID:和--existingObjectWithID之间有什么区别:错误:? - What's the difference between -objectRegisteredForID: and -existingObjectWithID:error:? 使用 CGFloat 和 float 有什么区别? - What's the difference between using CGFloat and float? InstantiateInitialViewController和InstantiateViewControllerWithIdentifier之间有什么区别? - What's the difference between instantiateInitialViewController and instantiateViewControllerWithIdentifier:? iOS中的NSCachesDirectory和NSDownloadsDirectory有什么区别? - what's the difference between NSCachesDirectory and NSDownloadsDirectory in iOS? Apple 音频框架之间有什么区别? - What's the difference between the Apple audio frameworks? UIControlStateHighlighted和UIControlStateSelected之间有什么区别? - What's the difference between UIControlStateHighlighted and UIControlStateSelected?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM