views:

60

answers:

1

Hi all,

I am trying to build a simple iPhone app that calls several static libraries. However, it seems when I include the linker flag "-ObjC" and "-all_load" (as I need to for one library), it causes the linker error:

ld: duplicate symbol
_OBJC_METACLASS_$_ASIFormDataRequest in /Users/XXXXX/Projects/AppName/Dependencies/Library1/lib1Kit.a(ASIFormDataRequest.o) and /Users/XXXXX/Projects/AppName/Dependencies/Library2/lib2Kit.a(ASIFormDataRequest.o)

When I remove the flag(s), the linker errors above disappear, but I get:

-[UIView height]: unrecognized selector sent to instance 0x13fe90

Has anyone seen this error and how it is related to -ObjC and/or -all_load? I am at a loss, so any help would be appreciated.

Thanks, Brett

A: 

The two errors are orthogonal.

The duplicate symbol error is because you have the same class defined in two separate static libraries. Remove it from one and the error will go away (removing it may be tricky, but not seeing your source that is impossible to tell).

The unrecognized selector error is most likely because you aren't managing memory correctly and have an object that is being freed prematurely. Run with Zombie detection enabled and it'll likely tell you what object is being prematurely released. Better yet, build all your code with Build and Analyze and fix the memory management errors identified first.

bbum
Hmmmmm....the libraries in use are downloaded, so the source(s) are not available. Are there any tricks you know of to move the symbols ala project settings?
Brett
Update: I fixed the error by removing "-all_load" and adding "-force_load /full_path_to_static_library.a" Simple enough.
Brett
Actually, I bet the "unrecognized selector" error is due to a missing category from one of the static libraries, which wasn't being linked in. That's what the -ObjC (and -all_load since 3.0) were probably intended to force for these libraries.
Brad Larson