Apple Mach-O Linker Error implicit entry/start for main executable

Apple Mach-O Linker Error implicit entry/start for main executable

我尝试 运行 我的应用程序时遇到了这个奇怪的错误。我已经 运行 多次使用我的应用程序并且运行良好。在我向其中一个 segues 添加标识符后,发生了此错误。当我点击 segue 时,xcode 变得很慢,我可能把标识符放在了错误的地方,或者删除了一些我不应该拥有的东西。当我单击名称中的 segue 时,有 main.m 或 main.h 不记得是哪个了。我把它误认为是标识符并试图删除它以便我可以命名标识符。延迟消失后,该选项也消失了。现在不知道怎么办了。

错误信息:

Ld /Users/life/Library/Developer/Xcode/DerivedData/MatrixGame-    empjzfoeajzkidevdewazcmxapsv/Build/Products/Debug-iphonesimulator/MatrixGame.app/MatrixGame normal x86_64
cd /Users/life/Desktop/MatrixGame
export IPHONEOS_DEPLOYMENT_TARGET=8.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/life/Library/Developer/Xcode/DerivedData/MatrixGame-empjzfoeajzkidevdewazcmxapsv/Build/Products/Debug-iphonesimulator -F/Users/life/Library/Developer/Xcode/DerivedData/MatrixGame-empjzfoeajzkidevdewazcmxapsv/Build/Products/Debug-iphonesimulator -filelist /Users/life/Library/Developer/Xcode/DerivedData/MatrixGame-empjzfoeajzkidevdewazcmxapsv/Build/Intermediates/MatrixGame.build/Debug-iphonesimulator/MatrixGame.build/Objects-normal/x86_64/MatrixGame.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.1 -Xlinker -dependency_info -Xlinker /Users/life/Library/Developer/Xcode/DerivedData/MatrixGame-empjzfoeajzkidevdewazcmxapsv/Build/Intermediates/MatrixGame.build/Debug-iphonesimulator/MatrixGame.build/Objects-normal/x86_64/MatrixGame_dependency_info.dat -o /Users/life/Library/Developer/Xcode/DerivedData/MatrixGame-empjzfoeajzkidevdewazcmxapsv/Build/Products/Debug-iphonesimulator/MatrixGame.app/MatrixGame

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

向您的项目添加一个新的 .m 文件,将其命名为 main

并在其中添加以下代码:

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

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

同样在您的项目中 info.plist 也丢失了,因此您需要添加一个新的。

希望对您有所帮助