入口点(_main)undefined xcode 6

问题描述 投票:15回答:7

我不能为我的生活找到解决方案!我正在使用Swift。我突然得到这个错误:

Undefined symbols for architecture i386:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture i386

无论我试图运行什么模拟器/设备,我仍然得到它:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64

这是什么?!我几乎删除了项目中的所有内容。即所有框架和一切。它还在那里。

请帮我

ios xcode
7个回答
23
投票

在你的AppDelegate.swift中有这个:

import UIKit

@UIApplicationMain


10
投票

另一个原因(不是为你而是为了寻找答案的其他人)是AppDelegate.swift由于某种原因未包含在应用目标中。我不知道为什么会这样 - 我认为这是我的用户错误 - 但没有它你会得到这个错误,原因并不明显。确保在应用目标中选中该文件的复选框。


5
投票

我的问题是:“main.m”被删除了项目。


3
投票

我的问题如下。我有2个AppDelegate文件。我要删除的原始文件和我想要添加的另一个文件。我首先将新的一个添加到项目中,然后删除旧的。按照此顺序创建了链接器错误。当我删除新的并将其再次添加到项目中时,它工作正常。干杯


2
投票

我有同样的错误,发现main.m包含在项目文件列表中,但没有在Target Membership列表中打勾。


2
投票

我有同样的问题,但我忘了把@UIApplicationMain放在AppDelegate.swift的顶部


0
投票

一些类和框架(如FB SDK)没有像图中那样勾选。所以,我在Project Navigator.enter image description here的所有类和框架中手动勾选(仅.m文件和框架)。

© www.soinside.com 2019 - 2024. All rights reserved.