Why do I get "_OBJC_CLASS _ $ ... referring to:" linker error when I linked the frameworks correctly?

My problem

I get "_OBJC_CLASS _ $ ..., citing:" a linker error while compiling some Xcode projects (this happens on both iOS and Mac projects). I have correctly linked frameworks and imports.

Customization

  • One purpose of the application
  • One test target
  • All frameworks are correctly connected.

When compiling, I get the following linker errors: "_OBJC_CLASS _ $ _ JGCountdownTimer" referenced: objc-class-ref in JGCountdownTimerTestCase.o

for many classes that are used in tests.

What i tried

  • Checked that import is present.
  • Removed all non-standard frameworks.
  • If I compile the class for both the target and the target program, it fixes the problem. But then I get other warnings from the compiler.
+8
objective-c linker xcode compiler-errors
source share
3 answers

Quick response

Copy and paste the following line into your build settings:

GCC_SYMBOLS_PRIVATE_EXTERN = NO

In the settings of the target assembly, find "Symbols hidden by default." For Debug configuration, you want No.

I had this problem for many months, and I just found out why.

+11
source share

I had a similar problem. I got a linker error:

_OBJC_CLASS_$_MyClass

The problem was that I declared @interface for MyClass , but did not declare its corresponding @implementation .

Fixed it was just add

 @implementation MyClass @end 
+10
source share

Not sure if this could be a problem, but with the new compiler, any obj-c that do not explicitly reference / invoked will not be linked to libraries. This causes problems when implementing categories in libraries, for example.

Try adding '-ObjC' to the 'additional linker flags' in the assembly settings panel for your purpose. shrug

+2
source share

All Articles