如何更正“架构 i386 的未定义符号:“_main”链接问题?

发布于 2024-12-29 17:04:32 字数 420 浏览 5 评论 0原文

我正在尝试使用苹果提供的 KeyChainitemwrapper 。我的项目正在使用 ARC,但我已经在 KeyChainitemwrapper.m 上关闭了 ARC。我将“security.framework”框架链接到我的项目。

我遇到这个链接问题:

架构 i386 的未定义符号: “_main”,引用自: 从 crt1.10.6.o 开始 ld:未找到架构 i386 的符号 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

我是 ios 开发新手,但我的猜测是问题与模拟器试图编译我的目标 i386 的源代码有关比手臂??我很接近吗?

不管怎样..看来这个包装器相当受欢迎,所以我想知道熟悉这个问题的人是否可以帮忙。

谢谢

I am trying to use the KeyChainitemwrapper provided by apple. My project is using ARC but I have turned of ARC on KeyChainitemwrapper.m. I linked the 'security.framework' framework to my project.

I am getting this linking issue:

Undefined symbols for architecture i386:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am new to ios development but my guess is that the problem has to do with the fact that the simulator is trying to compile my source targeting i386 rather than arm?? Am I close?

Anyways.. it appears that this wrapper is fairly popular so I was wondering if someone who might be familiar with this problem could lend a hand.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

尘世孤行 2025-01-05 17:04:32

这表明您没有在项目中编译 main.m。确保以下几点:

  • 您的项目中有一个 main.m
  • 它有一个名为 main() 的函数
  • 您实际上正在编译它。转到您的项目,然后构建阶段,然后编译源。确保 main.m 在列表中。

This suggests that you're not compiling main.m in your project. Make sure of the following:

  • You have a main.m in your project
  • It has a function in it called main()
  • You're actually compiling it. Go to your project, then Build Phases, then Compile Sources. Make sure main.m is in the list.
千仐 2025-01-05 17:04:32

当您使用模拟器时,您的代码将针对 i386 架构进行编译。
如果您使用真实设备,您的代码将为arm编译。

我下载了这个项目,“其他来源”组中有一个 main.c 文件。

your code will be compiled for i386 architecture when you use the simulator.
If you use a real device your code will be compiled for arm.

i downloaded this project, there is a main.c file inside "other sources" group.

神爱温柔 2025-01-05 17:04:32

删除项目中对 main.ce 的引用为我解决了这个问题

Removing the references to main.ce in your project solve this problem for me

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文