xicun
xicun

Reputation: 71

iOS and Xcode: custom frameworks link error, undefined symbols

I use custom static frameworks to package my modules, such as A, B, C..., and A is a foundation layer, so B & C depend on A, they all use a symbol in A named "Semaphore".

Now I add A, B, C into my App "DemoX", DemoX only use B & C directly, when linking there is an error.

Changed: DemoX depends on a static library "libM" which uses A directly.

Undefined symbols for architecture i386:

"_OBJC_CLASS_$_Semaphore", referenced from:
      objc-class-ref in libM.a
      objc-class-ref in B
      objc-class-ref in C
ld: symbol(s) not found for architecture i386

Actually, I use "nm" command to show the symbols in A, it has "_OBJC_CLASS_$_Semaphore". So, how to solve this?

Thanks!

Upvotes: 3

Views: 1799

Answers (1)

xicun
xicun

Reputation: 71

I solved this.

It's all my fault, this error occurs in release only, because I compile A with "Symbols Hidden by Default" YES, so others can't see all the symbols A has. Set it to NO, all is good.

Upvotes: 4

Related Questions