Changes

Jump to: navigation, search

Using Objective-C Preprocessor Directives

No change in size, 20:39, 12 November 2009
The #import Directive
== The #import Directive ==
The final directive we will look at is one you will probably have seen many times already in previous chapters. The ''#import'' directive allows you to import include files into your source files. We have doen done this many times when we have included the Foundation Framework headers in our example programs:
<tt>#import <Foundation/Foundation.h></tt>
This particular import statement has the path encapsulated by < and > characters. This means that the specified header file is to be found relative to system includes directory (or any other include directories defined for the compilation). To import a header file relative to the directory containing the source file, the file name must enclosed in quotes:
<tt>#import "includes/myincludes.h<//ttt>
The above example imports a header file named ''myincludes.h'' located in a sub-directory of the current directory called ''includes''. This technique may also be used to specify an absolute path (i.e. one that is not relative to the current directory):

Navigation menu