Apple Mach-O链接器错误隐式进入/启动主可执行文件

时间:2015-06-16 11:32:00

标签: ios objective-c xcode compiler-errors

当我试图运行我的应用程序时,我遇到了这个奇怪的错误。我已经多次运行我的应用程序,它工作正常。在我向其中一个segue添加标识符后发生了此错误。当我点击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)

1 个答案:

答案 0 :(得分:2)

将新的.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也缺失,因此您需要添加一个新的。

希望有所帮助