这些进口有什么区别?

时间:2023-01-24 00:02:45

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?

那有什么不同呢?第一个是<>标签的东西,第二个是双引号。第一个做什么?这是用于预编译文件,如已编译的框架?或者有什么意义呢?

2 个解决方案

#1


5  

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

#2


1  

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

EG for Visual C ++

#1


5  

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

#2


1  

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

EG for Visual C ++