I'm trying to build my first static library and i'm having a compile problem. I mean I can compile my library and every thing looks fine, but when I set up a test project to test it I got this kind of error:
ld: warning: ignoring file /Users/*/Desktop/TestApp/LibProva/libProva.a, file was built for archive which is not the architecture being linked (i386) Undefined symbols for architecture i386: "_OBJC_CLASS_$_Prova", referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: ignoring file /Users/**/Desktop/TestApp/LibProva/libProva.a, file was built for archive which is not the architecture being linked (i386)
So I guess thats something wrong with compiling (due to different architectures in simulator and in device), but I can not find out how to do it the right way. Can someone explain me how to solve this problem?
You must use lipo to create a universal binary:
Be sure to replace instances of
libmylib.a
with the actual name of the.a
generated byxcodebuild
.