I'm a complete newbie to XCode(4.2). I'm trying to write a simple unit test for a simple class I've written.
I've created an empty application project, I've included unit tests. I have two targets:
- Calculator
- UnitTests
I've added a class (Calculations) to the Calculator group, and a corresponding unit test class (CalculationsTest) to the UnitTests group.
The problem comes when I attempt to instantiate a Calculations object in my CalculationsTest and then run it. I end up with a linking error:
"_OBJC_CLASS_$_Calculations", referenced from:
objc-class-ref in CalculationsTest.o
Now I can solve this by adding Calculations.m to the UnitTests target in the utilities view when looking at the file.
I feel as if I'm missing something, as when my project grows and has many more dependencies between objects, I need to add every class *.m definition to both the Calculator target and the UnitTests target.
Is there some way of introducing a dependency so that UnitTests always knows about the Calculator sources?
I've attempted to use the Build Phases in the target set up, however adding Calculator to the Target Dependencies of UnitTests doesn't appear to solve this.