包含和导入之间的区别 [英] Difference Between includes and imports

查看:155
本文介绍了包含和导入之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

Objective-C中#import和#include之间有什么区别?

有什么区别

#include< >
#include" "

#import< >
#import" "


推荐答案

#import 指令是 #include 的改进版本。
#import 确保文件只被包含一次,这样你就不会有递归包含的问题。

The #import directive is an improved version of #include. #import ensures that a file is only ever included once so that you never have a problem with recursive includes.

#import首先检查项目文件夹中的标题然后转到系统库,#import<> 检查系统头。理论上,位置是编译器定义的,它们可以在给定平台上以不同方式实现。

#import "" first check the header in project folder then goes to system library, and the #import<> checks for system headers". In theory the locations are compiler defined and they could be implemented differently on a given platform.

这篇关于包含和导入之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆