In building a recent project I encountered an error during the linking process. I want to point out the error message and show you how this simple error can be resolved. The reason for pointing out this error is that I have no idea why this error came about…more on that in a moment.
Start by looking at the figure below:
The problem we have here is that the class SomeClass is referenced inside the file PrivateMethods implementation file (the .o extension represents the compiled object of the PrivateMethod class).
For some reason SomeClass is not included in the target, that is, SomeClass is not included in the list of object files that make up the final executable. Upon giving this error some thought, the obvious place to look is at the list of files that make up the target. We can do this by looking at the Details tab as shown below:
Notice that SomeClass.m is not included in the target (see the rightmost column). Simply clicking to add this file to the target, rebuilding, and all is well.
The reason for presenting this relatively trivial problem, and the change to correct this, is that I did not (intentionally) remove this file from the target. The point being, even if you never mess with target files and/or related build configuration, you still may need to visit these options if you receive linking errors.