How do I correct the "Undefined symbols for architecture i386: "_main" linking issue?
Asked Answered
G

3

6

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

Ganesa answered 29/1, 2012 at 0:5 Comment(0)
A
24

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.
Airy answered 29/1, 2012 at 0:33 Comment(5)
Thanks for the reply. My project does not contain a file called main.m. Also I can find no reference to 'main'.Ganesa
There you go. You have no main(), as the compiler indicates. You should probably rebuild your project from a project template.Airy
I did begin with a project template. Perhaps I have disabled the building of something??Ganesa
I mistakenly blew away the 'supporting ..' group which did indeed contain main. oops. Thanks a lot!Ganesa
if anyone else wonders, this main.m file is hidden by default, you must use finder to locate it, create new project, copy it to the old project and include it in the Compile Sources under the Build Phases tabTour
P
0

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.

Peerless answered 29/1, 2012 at 1:0 Comment(0)
P
0

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

Penthea answered 4/2, 2013 at 10:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.