How do I correct the “Undefined symbols for archit

2019-02-22 04:25发布

问题:

I am trying to use the KeyChainitemwrapper provided by apple. My project is using ARC but I have turned of ARC on KeyChainitemwrapper.m. I linked the 'security.framework' framework to my project.

I am getting this linking issue:

Undefined symbols for architecture i386: "_main", referenced from: start in crt1.10.6.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am new to ios development but my guess is that the problem has to do with the fact that the simulator is trying to compile my source targeting i386 rather than arm?? Am I close?

Anyways.. it appears that this wrapper is fairly popular so I was wondering if someone who might be familiar with this problem could lend a hand.

Thanks

回答1:

This suggests that you're not compiling main.m in your project. Make sure of the following:

  • You have a main.m in your project
  • It has a function in it called main()
  • You're actually compiling it. Go to your project, then Build Phases, then Compile Sources. Make sure main.m is in the list.


回答2:

your code will be compiled for i386 architecture when you use the simulator. If you use a real device your code will be compiled for arm.

i downloaded this project, there is a main.c file inside "other sources" group.



回答3:

Removing the references to main.ce in your project solve this problem for me