Compiler Error Messages
Sometimes (many times!) code does not compile properly, as you can see in the PB window in Figure 5-27.
Figure 5-27. Compiler errors in PB’s main window
If instead of a clean compile you get compiler warning or error
messages, you have probably made a typographical error at some point
in the code. For example, the error message in Figure 5-27 was generated by removing the first semicolon
from the displayX method in the
Controller.m
file (the semicolon is missing from
the statement above the highlighted statement at the bottom in Figure 5-27).
If you click on an error message in the top-right panel of
PB’s window (e.g., “syntax error,
found
’setStringValue’”),
the offending line of code will be highlighted in the source code
file, Controller.m
. If you double-click the
error message, a new window will open with the line containing the
error highlighted (actually, the error is in the previous line, but
it doesn’t cause a problem until the highlighted
line). This is a great help in finding and fixing compiler errors!
If you get compiler errors for source code that you type in from this book, we suggest that you first reexamine your code line by line, rather than downloading our code from the Web. Examining code for errors is an important skill to develop.
As an alternative to double-clicking an error message, you can open
the Controller.m
file in a PB editor window, ...
Get Building Cocoa Applications: A Step by Step Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.