I am trying to compile a file in Mac OS X but keep on getting the error
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Could any one help to find out what this error means?
You are missing main
definition in the program which is the starting point of any executable. So, linker is complaining because it didn't find the entry point ( which is main
) for the final executable.
Undefined symbols:
"_main",
Meaning there is no _main
in any of the source files compiled. ( i.e., int main(void)
, int main( int agrc, const char* argv[]
in C, C++ )
ld: symbol(s) not found
Meaning it is a linker error. Linker binds all the object files to a single executable. At this time it checks whether there is entry point at all for the executable. It isn't in your case, so it is complaining.