PDA

View Full Version : Import vs Include




teguh123
Apr 7, 2011, 10:36 AM
Is there any reason why we would bother using #include now that we have #import?

The code here:

Use include once. I wonder why

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreDataUtilityTutorial/Articles/08_sourceListings.html



Hansr
Apr 7, 2011, 10:49 AM
Just use #import unless you wind up using headers with the same name. See:
http://stackoverflow.com/questions/439662/what-is-the-difference-between-import-and-include-in-objective-c

PhoneyDeveloper
Apr 7, 2011, 10:55 AM
One might use #include for a C header or from a C source file. You can do it either way from Objective-C code. If the header is a C header then there should be no real difference.