1

I created a static library with Xcode I have compiled selecting a device.

I added this to my library test project in Xcode 4.6

but I always have 2 errors during the linking...

I followed this tutorial: Static Library iOS Tutorial

if I download the sample code I have the same errors:

ld: warning: ignoring file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a, missing required architecture i386 in file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a (2 slices) Undefined symbols for architecture i386: "_OBJC_CLASS_$_MathFunctions", referenced from: objc-class-ref in MathTestAppDelegate.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

6
  • which errors? because "2 errors during the linking" is not informative at all. Commented Feb 5, 2013 at 17:42
  • Two errors. 1. Missing ; and 2. Solve first error. Commented Feb 5, 2013 at 17:42
  • Just a note of sympathy: Static libraries suck in Xcode. Commented Feb 5, 2013 at 17:53
  • @HotLicks Is there anything that does not suck in Xcode? (Well, to be fair, at least the syntax highlighting/autoindentation is quite good, but the rests sucks, really.) Commented Feb 5, 2013 at 18:15
  • 1
    Static libraries outsuck most everything else. Commented Feb 5, 2013 at 18:16

4 Answers 4

1

I had once made a static lirary , I had the same problem . Solution was to "Run the app on device " not on simulator , it works fine then !!! Hope this helps...

Sign up to request clarification or add additional context in comments.

Comments

1

I followed this step by step tutorial:

Tutorial

in particular I had to add these flags: -ObjC and -all_load

1 Comment

So, what did you add them to?
1

You must have selected iOS simulator while building the project. Select iOS device and it should be fine.

Comments

0

Do read and try to understand the error message, it's a meaningful English phrase.

symbol(s) not found for architecture i386

So there's no compiled code for the i386 architecture in the library. This means that either it's compiled for ARM only (for actual iOS devices, like iPhone or iPad), or for the 64-bit simulator (x86_64). Use otool to find out the architectures present in the library.

1 Comment

Yeah, but try to figure out which of the 3492 different knobs in Xcode to turn to fix it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.