xcode 目标 C:“_main”,引用自:Start in crt1.3.1.o 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2643036/
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
Objective C: "_main", referenced from: Start in crt1.3.1.o error
提问by drekka
Trying to compile a iPhone/iPad application with SDK3.2 and am getting this error:
尝试使用 SDK3.2 编译 iPhone/iPad 应用程序并收到此错误:
Undefined symbols:
"_main", referenced from:
Start in crt1.10.5.o
Symbol(s) not found
Collect2: Id returned 1 exit status
I think it's telling me that it's somehow trying to work with code from another SDK but searching the web has not provided any clear answers.
我认为它告诉我它以某种方式尝试使用来自另一个 SDK 的代码,但在网络上搜索并没有提供任何明确的答案。
Anyone able to guide me on this and what to look for?
任何人都能够在这方面指导我以及要寻找什么?
回答by paxdiablo
It lookslike you haven't provided a main
function in any of your source files. The crt
object file is most likely the startup code which sets up your environment then calls main
(CRT usually stands for C runtime, when it's not being used to mean Cathode Ray Tube, which it shouldn't any more, that being dead technology and all).
它看起来像你还没有提供main
任何源文件的功能。该crt
目标文件是最有可能启动代码设置了您的环境,然后调用main
(CRT通常代表C运行时,当它没有被用来指阴极射线管,它应该没有任何更多,上死了的技术和全部) .
The Undefined symbols: "_main" ...
simply means that the linker has discovered crt1.10.5.o
needs the _main
symbol satisfied and none of the files provided are satisfying it.
在Undefined symbols: "_main" ...
简单的说就是连接已经发现crt1.10.5.o
需要的_main
符号满意,没有提供这些文件都令人满足的事情。
Short of seeing the actual linker command line, we can't be certain what's being included. You should check your source code and confirm or deny the existence of main()
? And that it's inluded in the build?
由于没有看到实际的链接器命令行,我们无法确定包含的内容。您应该检查您的源代码并确认或否认main()
? 并且它包含在构建中?
回答by Chidj
There appears to be several possible causes.
似乎有几种可能的原因。
I ran into this problem when the Perform Single-Object Prelinkbuild option was checked (GENERATE_MASTER_OBJECT_FILE = YES).
选中执行单对象预链接构建选项 (GENERATE_MASTER_OBJECT_FILE = YES)时,我遇到了这个问题。
回答by CaptainQuality
I got this when I opened a Swift project in Xcode 5. When I opened it in Xcode 6, it worked fine.
我在 Xcode 5 中打开一个 Swift 项目时得到了这个。当我在 Xcode 6 中打开它时,它运行良好。