ios - "Undefined symbols for architecture" clang error (using static library) while the symbol definition is present -


i developing open-source ios static library demo project. created "library" xcodeproj, created class dknavigationbar, included had include it. created "demo" xcodeproj , dragged "library" xcodeproj it. included static library in "target dependencies" section , imported library in pch file using #import <mylibrary/mylibrary.h>. built demo project , there no errors @ all. then, in dkdappdelegate.m called [dknavigationbar class] - lldb gave me no error. built project , boom:

undefined symbols architecture i386:   "_objc_class_$_dknavigationbar", referenced from:       objc-class-ref in dkdappdelegate.o ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation) 

at first glance, seems normal mistake: "oh, forgot add source file 'compile sources' build phase". when looked deeper , deeper realized set correctly. after research realized symbol definition is present in .a file , static library built architecture:

$ cd /path/to/derived/data/product/folder  $ lipo -info libmylibrary.a input file libmylibrary.a not fat file non-fat file: libmylibrary.a architecture: i386  $ otool -mvv libmylibrary.a archive : libmylibrary.a libmylibrary.a(dknavigationbar.o): module table (0 entries)  $ nm libmylibrary.a libmylibrary.a(dknavigationbar.o): 00000074 s _objc_class_$_dknavigationbar          u _objc_class_$_uinavigationbar 00000060 s _objc_metaclass_$_dknavigationbar          u _objc_metaclass_$_nsobject          u _objc_metaclass_$_uinavigationbar          u __objc_empty_cache          u __objc_empty_vtable 00000038 s l_objc_class_ro_$_dknavigationbar 00000010 s l_objc_metaclass_ro_$_dknavigationbar 

now have no idea what's going wrong. appreciated.


tl;dr

  1. i created static library project , did correctly
  2. i created demo project, dragged library project , included library in "target dependencies", , did correctly
  3. xcode recognizes header files , live debugger gives me no error.
  4. when building, undefined symbols architecture clang error pops up
  5. i examined built libmylibrary.a file , found out symbol definition is there.

p.s.

i using dp3 of xcode 5, not discuss features or whatever, stop telling me it's under nda, because not break agreement. i'm letting know might bug in beta software (but don't think so).

add library under "link binary libraries" in build phases.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -