Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective C: "_main", referenced from: Start in crt1.3.1.o error

Trying to compile a iPhone/iPad application with SDK3.2 and am getting this error:

Undefined symbols:
"_main", referenced from:
Start in crt1.10.5.o
Symbol(s) not found
Collect2: Id returned 1 exit status

I think it's telling me that it's somehow trying to work with code from another SDK but searching the web has not provided any clear answers.

Anyone able to guide me on this and what to look for?

like image 832
drekka Avatar asked Apr 15 '10 05:04

drekka


2 Answers

It looks like you haven't provided a main function in any of your source files. The crt object file is most likely the startup code which sets up your environment then calls main (CRT usually stands for C runtime, when it's not being used to mean Cathode Ray Tube, which it shouldn't any more, that being dead technology and all).

The Undefined symbols: "_main" ... simply means that the linker has discovered crt1.10.5.o needs the _main symbol satisfied and none of the files provided are satisfying it.

Short of seeing the actual linker command line, we can't be certain what's being included. You should check your source code and confirm or deny the existence of main()? And that it's inluded in the build?

like image 88
paxdiablo Avatar answered Oct 22 '22 14:10

paxdiablo


There appears to be several possible causes.

I ran into this problem when the Perform Single-Object Prelink build option was checked (GENERATE_MASTER_OBJECT_FILE = YES).

like image 38
Chidj Avatar answered Oct 22 '22 15:10

Chidj