Graphics Programs Reference
In-Depth Information
come part of the generated intermediate file, and the compiler has no idea what to do with
these lines of code. Note that the compiler can only read one intermediate file at a time, so
even though the class and protocol are in other intermediate files, the compiler still gener-
ates an error when they are not declared for WhereamiViewController.m .
Uncomment the import statement. You should be able to build again with no errors.
Linking
An object file contains the machine code for the methods implemented in the implementa-
tion file. However, within an implementation file, you use code from other implementa-
tion files. For example, WhereamiViewController.m uses the startUpdat-
ingLocation method, and the machine code for that method is in the object file gener-
ated from CLLocationManager.m .
Instead of copying the code for this method into the object file for WhereamiViewCon-
troller.m , the compiler leaves a link to the object file for CLLocationMan-
ager.m . The Link Binary With Libraries phase is where these links are resolved. For
short, we just call it the linking phase.
Recall earlier in the chapter that you linked the Core Location framework to your target. A
framework is a collection of classes, and a class is defined by two files: a header file and
an implementation file. A framework, however, has pre-compiled its implementation files
and shoved the resulting object files into one or more library files. (That's why in
Objective-C you can't see the implementation files in a framework - they are already ma-
chine code.) Where you used code from the classes in the Core Location framework in
your own classes, the compiler put a link in your object files to the Core Location library
( Figure 4.18 ) .
Figure 4.18 Compiler creates object files; linker resolves links
 
Search WWH ::




Custom Search