What are the differences between #import and #include in Objective-C and are there times where you should use one over the other? Is one deprecated?
I was reading th
I agree with Jason.
I got caught out doing this:
#import // to use gettimeofday() function
#import // to use time() function
For GNU gcc, it kept complaining that time() function was not defined.
So then I changed #import to #include and all went ok.
Reason:
You #import
You #import
No go. Even though only part of
far as #import is concerned, that file is now already completely included.
Bottom line:
C/C++ headers traditionally includes parts of other include files.
So for C/C++ headers, use #include.
For objc/objc++ headers, use #import.