入口点 (_main) 未定义 xcode 6
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26801695/
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
entry point (_main) undefined xcode 6
提问by ullstrm
I can't for the life of me find a solution to this! I'm using Swift. All of a sudden I get this error:
我这辈子都找不到解决办法!我正在使用斯威夫特。突然间我收到此错误:
Undefined symbols for architecture i386:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture i386
It doesn't matter what simulator/device I try to run for, I still get it:
不管我尝试运行什么模拟器/设备,我仍然得到它:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
What is this?! I've almost removed everything from my project. I.e. all frameworks and everything. It's still there.
这是什么?!我几乎从我的项目中删除了所有内容。即所有框架和一切。它仍然存在。
Please help me
请帮我
回答by t1ser
Have this in your AppDelegate.swift:
在你的 AppDelegate.swift 中有这个:
import UIKit
@UIApplicationMain
@UIApplicationMain
回答by Tom Harrington
Another cause (not for you but for others searching for an answer) is that AppDelegate.swift
is for some reason not included in the app target. I don't know why that would happen-- I assume it was user error on my part-- but without that you'll get this error, and the cause isn't obvious. Make sure the checkbox for the file is checked in the app target.
另一个原因(不是为您,而是为其他人寻找答案)AppDelegate.swift
是由于某种原因未包含在应用程序目标中。我不知道为什么会发生这种情况——我认为这是我的用户错误——但如果没有,你会得到这个错误,原因并不明显。确保在应用程序目标中选中了该文件的复选框。
回答by iHTCboy
My Issue was this: "main.m" got removed the project.
我的问题是:“main.m”已删除项目。
回答by Tiago Couto
I had the same problem, but I just forgot to put @UIApplicationMain
on the top of the AppDelegate.swift
我有同样的问题,但我只是忘了把@UIApplicationMain
AppDelegate.swift放在上面
回答by castillejoale
My problem was the following. I had 2 AppDelegate files. The original one that I wanted to delete, and another one I wanted to add. I first added the new one to the project and then deleted the old one. Following this order created a linker error. It worked when I deleted the new one and added it again to the project. Cheers
我的问题如下。我有 2 个 AppDelegate 文件。我想删除的原始一个,以及我想添加的另一个。我首先将新的添加到项目中,然后删除了旧的。按照此顺序创建链接器错误。当我删除新的并将其重新添加到项目中时,它起作用了。干杯
回答by Bill
I had this same error and found that main.m was included in the list of project files, but was not ticked in the Target Membership list.
我有同样的错误,发现 main.m 包含在项目文件列表中,但没有在目标成员列表中打勾。
回答by Anurag Sharma
回答by islam XDeveloper
If this error come you have two problems:
如果出现此错误,您有两个问题:
- you comment out (with
//
) theappleDelegate.swift
, you should uncomment it - you miss the
appleDelegate.swift
in your project
- 你注释掉(用
//
)appleDelegate.swift
,你应该取消注释它 - 你错过了
appleDelegate.swift
你的项目