Adam S. Adam S. - 1 year ago 223
Swift Question

What does this mean: Undefined symbols for architecture x86_64 "_main"

I keep getting errors upon building my application on Xcode:

Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64

None of my code is erroring and the errors are weird errors and anything I do does not resolve it. I don't think the code is relevant to the issues because it isn't referenced in the error.

This is a screenshot of the error.enter image description here

Answer Source

The linker has not been able to find any file in the linking process with the main swift entry point. This can be due to the file not existing at all in your project, or that it exists but has not been included in the compile or link build phases.

In Swift, the main swift entry point is defined in a main.swift module, or (for iOS) in the AppDelegate.swift file there needs to be a @UIApplicationMain declaration. I don't see a Compile main.swift in your log, perhaps its missing or not included in the build phases?