OCUnit link problem question
I want to write unit test for my classes but I cannot solve linking problem. in test header, i did #import "myclass.h" but then when i allocate myclass object in test implementation file, it couldn't find symbol. I already added dependency tho.
"OBJC_CLASS_$_PhotoArrayControl", referenced from:
objc-class-ref-to-PhotoArrayControl in PhotoArrayControlUnitTest.o
(maybe you meant: _OBJC_CLASS_$_PhotoArrayControlUnitTest)
ld: symbol开发者_JAVA百科(s) not found
any ideas?
This kind of error is hard to diagnose so it's a long shot, but link errors mean that while your compiler was told about a specific symbol during the parsing stage, in the final step, it noticed that it doesn't know where it is. This likely means your .m
file didn't get compiled with the rest of your test code, which is probably because your .m file isn't a member of your test target.
In Xcode 4, select you .m file and bring up the right panel (by clicking the rightmost icon in the "View" category of the toolbar). There should be a section called "Target Membership"; make sure your test bundle is checked. In Xcode 3, make your test bundle your active target and make sure the checkbox in the rightmost column of the project explorer is checked.
精彩评论