入口点 (_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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 06:07:23  来源:igfitidea点击:

entry point (_main) undefined xcode 6

iosxcode

提问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.swiftis 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 @UIApplicationMainon the top of the AppDelegate.swift

我有同样的问题,但我只是忘了把@UIApplicationMainAppDelegate.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

Some of the classes and frameworks(like FB SDK) are not ticked like in the picture. So, I manually ticked(only .m files and frameworks) in all classes and frameworks in the Project Navigator.enter image description here

一些类和框架(如 FB SDK)没有像图中那样打勾。因此,我在项目导航器中的所有类和框架中手动勾选(仅 .m 文件和框架)。在此处输入图片说明

回答by islam XDeveloper

If this error come you have two problems:

如果出现此错误,您有两个问题:

  1. you comment out (with //) the appleDelegate.swift, you should uncomment it
  2. you miss the appleDelegate.swiftin your project
  1. 你注释掉(用//appleDelegate.swift,你应该取消注释它
  2. 你错过了appleDelegate.swift你的项目