Xcode error: "_main", referenced from: implicit entry/start for main executable

My case was very similar, but slightly different. The solution was in part prompted by @Midhun-MP's answer above.

In my instance, I had added a tvOS version of my app. After adding the new target however, main.m was not selected under Target Membership (thus, the warning messages about Undefined symbols for architecture x86_64: "_main"). Checked that off and bam -- I'm GTG.

Thanks @Midhun-MP.

main.m


I checked your project. The issue is simple, in your project there is no main.m file. I think you accidentally deleted that.

Add a new .m file to your project, name it as main

And add the following code to it:

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

int main(int argc, char * argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

Also in your project the info.plist is also missing, so you need to add a new one.


add @UIApplicationMain to the AppDelegate

Tags:

Ios

Xcode

Clang