[英]entry point (_main) undefined xcode 6
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.
我几乎从我的项目中删除了所有内容。 Ie all frameworks and everything.
即所有框架和一切。 It's still there.
它仍然存在。
Please help me请帮我
Have this in your AppDelegate.swift:在你的 AppDelegate.swift 中有这个:
import UIKit
@UIApplicationMain @UIApplicationMain
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.另一个原因(不是针对您,而是针对其他寻找答案的人)是
AppDelegate.swift
由于某种原因未包含在应用程序目标中。 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.
确保在应用程序目标中选中了该文件的复选框。
我有同样的问题,但我只是忘了把@UIApplicationMain
放在 AppDelegate.swift 的顶部
我的问题是:“main.m”已删除项目。
My problem was the following.我的问题如下。 I had 2 AppDelegate files.
我有 2 个 AppDelegate 文件。 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
干杯
我有同样的错误,发现 main.m 包含在项目文件列表中,但没有在目标成员列表中打勾。
If this error come you have two problems:如果出现此错误,您有两个问题:
//
) the appleDelegate.swift
, you should uncomment it//
) appleDelegate.swift
,你应该取消注释它appleDelegate.swift
in your projectappleDelegate.swift
要在 Xcode 12.3 中解决此问题,请将@main
属性添加到AppDelegate
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.