1

I have followed this tutorial LINK

but i get a linker error when i added the lib and its .h to the project.

i searched google and i found that -ObjC and -all_load should be addd in setting i did it but the error couldn't be solved.The error is as follows:

ld: warning: ignoring file /Users/techvedika/Desktop/RND/MathTest/MathTest/iCodeBlogsMathLibrary/libICodeMathUtils.a, missing required architecture i386 in file /Users/techvedika/Desktop/RND/MathTest/MathTest/iCodeBlogsMathLibrary/libICodeMathUtils.a (3 slices) Undefined symbols for architecture i386: "_OBJC_CLASS_$_MathFunctions", 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)

how do i solve this?

user2798258
  • 171
  • 1
  • 4
  • 13

3 Answers3

2

Can you please check lipo -info libICodeMathUtils.a on terminal. If it is not listing architecture i386 that means your library is not build for simulator. And it will not work on simulator

Anil Varghese
  • 42,757
  • 9
  • 93
  • 110
  • Architectures in the fat file: /Users/techvedika/Desktop/iCodeBlogsMathLibrary/libICodeMathUtils.a are: armv7 (cputype (12) cpusubtype (11)) (cputype (16777228) cpusubtype (0)) what should i do in order for it to wrk in simulator. – user2798258 Feb 28 '14 at 10:20
  • Do you have source of that library? – Anil Varghese Feb 28 '14 at 10:37
  • follow [this](http://www.raywenderlich.com/41377/creating-a-static-library-in-ios-tutorial) to create static library. You need to build the library against simulator and device. And combine both to create a universal library to work on both simulator and device – Anil Varghese Feb 28 '14 at 11:41
  • I have tried tutorial i could not build the lib project with simulator settings.Also, I could not find the tool "LIPO" which was mentioned in the tutorial.Can u please help me with this. – user2798258 Mar 03 '14 at 06:23
  • `lipo` you can try it from the terminal. `lipo -create .a .a -output lib.a` – Anil Varghese Mar 03 '14 at 07:36
  • how do i create .a.Can u give me an example? – user2798258 Mar 10 '14 at 06:16
  • While building select the simulator instead of device. This will build for simulator. Don't forget to build in release mode – Anil Varghese Mar 10 '14 at 06:20
  • did as u said but the build succeeded but the lib file was not generated :( where do i find them. – user2798258 Mar 10 '14 at 06:30
  • Are you able to build it for device? – Anil Varghese Mar 10 '14 at 06:32
  • i got it now. first build it for device and then for simulator then the build was generated.then using the LIPO cmd i generated final build which works for both device and simulator.Thanks a lot Anil. – user2798258 Mar 10 '14 at 06:47
1

obviously, this is not a crash , it's just a link error, your project lack of i386 version libICodeMathUtils.a, so you should first add libICodeMathUtils.a to your project.

zhzhy
  • 461
  • 3
  • 17
  • how do i get i386 versiosn library are there any settings? – user2798258 Mar 10 '14 at 06:18
  • @user2798258,follow this [link](http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4), you can get a universal library include device and simulator. – zhzhy Mar 11 '14 at 03:02
0

The MathFunctions class is missing. Either from your application project or from the SimpleLibrary.a that you use. Make sure it is part of the compilation and linking steps of your build.

Noor
  • 2,071
  • 19
  • 28