ios - Apple Mach-O Linker Error 主可执行文件的隐式输入/启动

标签 ios objective-c xcode compiler-errors

当我试图运行我的应用程序时,我遇到了这个奇怪的错误。我已经多次运行我的应用程序并且运行良好。在我向其中一个 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,因此您需要添加一个新的。

希望对你有帮助

关于ios - Apple Mach-O Linker Error 主可执行文件的隐式输入/启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30866351/

相关文章:

ios - xib 文件在 xcode 5 中打开,但在 xcode 4.6.2 中无法打开。

ios - 连接蓝牙耳机时无法切换到扬声器输出

ios - UIButton 层样式使应用程序变慢

xcode - 从 Google Maps SDK 过渡到 Google Maps CocoaPod

javascript - 无法使用来自 JavaScriptCore 的 Swift 类

ios - Controller 中泛型类的属性注入(inject)

ios - Swift 中的自定义表格 View 单元格,没有 Storyboard

ios - 在 IOS 中将弧度转换为度数

ios - 在 iOS 中重用样式

ios - UIWebView 路径取决于之前按下的按钮 Xcode