简体   繁体   中英

What does this error in Xcode mean?

When I build my app it randomly gives me this error:

ld: entry point (_main) undefined. for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I really don't know how to explain it because I have no idea what it means and I have no idea where it can be coming from.

Here is my github link: https://github.com/nneeranjun/Map-Exercise.git

You're missing a main.m file, which is normally created automatically when you start a new project in Xcode.

For a typical generic Cocoa Touch application, it looks like this:

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

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

After you've created the file, add it to the project (File menu, "Add Files to "project name").

Once you have added the file to the project, you need to make sure it's included in the target. Select the file in the project navigator, and go to the View menu and select Utilities->Show File Inspector to show the file inspector. Check the "Target Membership" setting, and make sure the file is included in the target for your application.

Create a main.m file.
Add the following code to this.

#import <UIKit/UIKit.h>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM