Possible Duplicate:
What is the difference between #import and #include in Objective-C?
What is the difference between
#include< >
#include" "
#import< >
#import" "
Possible Duplicate:
What is the difference between #import and #include in Objective-C?
What is the difference between
#include< >
#include" "
#import< >
#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 ""
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.The #import directive was added to Objective-C as an improved version of #include. Whether or not it's improved, however, is still a matter of debate. #import ensures that a file is only ever included once so that you never have a problem with recursive includes. However, most decent header files protect themselves against this anyway, so it's not really that much of a benefit.
What is the difference between #import and #include in Objective-C? :
When using
#import
, the header include guard is unnecessary. Otherwise, it's just like#include
.The header include guard, seen in C and C++ files:
import is super set of include, it make sure file is included only once. this save you from recursive inclusion. about "" and <>. "" search in local directory and <> is use for system files.