My Problem
I getting "_OBJC_CLASS_$..., referenced from:" linker error when compiling some Xcode projects (it happens in both iOS and Mac projects) I have correctly linked frameworks and imports.
Setup
On compile I get the following linker errors: "_OBJC_CLASS_$_JGCountdownTimer", referenced from: objc-class-ref in JGCountdownTimerTestCase.o
for many classes that are used in tests.
What I've Tried
I faced a similar problem. I got the linker error:
_OBJC_CLASS_$_MyClass
The problem was that I had declared an @interface
for MyClass
but had not declared its corresponding @implementation
.
The fix was to simply add
@implementation MyClass
@end
Quick Answer
Copy and paste the following line into your build settings:
GCC_SYMBOLS_PRIVATE_EXTERN = NO
In the target build settings look for "Symbols Hidden by Default". For the Debug configuration you want "No".
I've had this problem on and off for many months and I've just discovered why.
Not sure if this could be the problem, but with the new compiler, any obj-c that aren't explicitly referred to/invoked will not be linked from libraries. This causes problems when you implement categories in libraries for example.
Try adding '-ObjC' to 'additional linker flags' in the build settings panel for your target. shrug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With