xcode 这是什么意思:体系结构 x86_64“_main”的未定义符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26436631/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does this mean: Undefined symbols for architecture x86_64 "_main"
提问by Adam S.
I keep getting errors upon building my application on Xcode:
在 Xcode 上构建应用程序时,我不断收到错误消息:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
None of my code is erroring and the errors are weird errors and anything I do does not resolve it. I don't think the code is relevant to the issues because it isn't referenced in the error.
我的代码都没有错误,错误是奇怪的错误,我所做的任何事情都无法解决。我不认为代码与问题相关,因为它没有在错误中引用。
This is a screenshot of the error.
这是错误的屏幕截图。
回答by Some Developer
The linker has not been able to find any file in the linking process with the main swift entry point. This can be due to the file not existing at all in your project, or that it exists but has not been included in the compile or link build phases.
链接器在与主要 swift 入口点的链接过程中找不到任何文件。这可能是由于该文件在您的项目中根本不存在,或者它存在但尚未包含在编译或链接构建阶段。
In Swift, the main swift entry point is defined in a main.swift
module, or (for iOS) in the AppDelegate.swift
file there needs to be a @UIApplicationMain
declaration. I don't see a Compile main.swift
in your log, perhaps its missing or not included in the build phases?
在 Swift 中,主要的 swift 入口点是在main.swift
模块中定义的,或者(对于 iOS)在AppDelegate.swift
文件中需要有一个@UIApplicationMain
声明。我Compile main.swift
在您的日志中没有看到 a ,也许它丢失或未包含在构建阶段?
回答by tsnkff
Just in case, check if your AppDelegate
app target is selected on the File Inspector.
以防万一,检查您的AppDelegate
应用程序目标是否在文件检查器上被选中。
( Select AppDeletage
> Show the Utility
> Show the file Inspector
> under Target Membership
, select your target.)
(选择AppDeletage
> 显示Utility
> 显示file Inspector
> 在 下Target Membership
,选择您的目标。)
It happened to me after renaming an existing file.
重命名现有文件后发生在我身上。
回答by jatin
Some time remove the reference of AppDelegate.swift from the project and add AppDelegate.swift again in project will work.
一段时间从项目中删除 AppDelegate.swift 的引用并在项目中再次添加 AppDelegate.swift 将起作用。