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
- One application target
- One test target
- All frameworks linked correctly
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
- Checked that imports are all present
- Removed all non standard frameworks
- If I compile a class for both the test target and the app target it fixes the issue. But then I get other warnings from the compiler.
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.