libiconv 未链接到 iOS 项目
我正在尝试将 MailCore 编译到我正在制作的 iOS 应用程序中,链接器一直抱怨 libiconv 未链接到至少我认为这是在抱怨。这就是它输出的内容:(
Undefined symbols for architecture i386:
"_iconv", referenced from:
_mail_iconv in libmailcore.a(charconv.o)
"_iconv_open", referenced from:
_charconv in libmailcore.a(charconv.o)
_charconv_buffer in libmailcore.a(charconv.o)
"_iconv_close", referenced from:
_charconv in libmailcore.a(charconv.o)
_charconv_buffer in libmailcore.a(charconv.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
这是为模拟器构建的。为我的 iPhone 构建会出现相同的错误,但是 s/i386/armv7/
)。
我尝试将 libiconv.dylib 添加到“将二进制文件与库链接”,但它根本没有改变错误。
知道这里可能出了什么问题吗?我一直在尝试用 Google 搜索此错误,但找不到有关如何在 libiconv 中链接的任何信息。既然它是iOS SDK的一部分,你会认为我不需要自己编译它吗?
I'm trying to compile MailCore into an iOS app I'm making, and the linker keeps complaining that libiconv isn't linked in. At least that's what I think it's complaining about. This is what it spits out:
Undefined symbols for architecture i386:
"_iconv", referenced from:
_mail_iconv in libmailcore.a(charconv.o)
"_iconv_open", referenced from:
_charconv in libmailcore.a(charconv.o)
_charconv_buffer in libmailcore.a(charconv.o)
"_iconv_close", referenced from:
_charconv in libmailcore.a(charconv.o)
_charconv_buffer in libmailcore.a(charconv.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
(This is building for the simulator. Building for my iPhone gives the same error, but s/i386/armv7/
).
I've tried adding libiconv.dylib
to "Link Binary with Libraries", but it doesn't change the errors at all.
Any idea what could be wrong here? I've been trying to Google this error, but I can't find any information about how to link in libiconv. Since it's part of the iOS SDK, you would think I shouldn't need to compile it myself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要通过“添加框架”添加libiconv.dylib。 SRC 可从此讨论中获取。
You need add libiconv.dylib via "add framework". SRC is available from this discussion.
作为额外确认该库包含在您的目标中,请在 Xcode 左窗格的文件列表中选择该库(假设您已将其添加到您的目标/项目中,您应该会看到框架下列出的框架),然后显示右侧窗格中的助理编辑器视图(视图 -> 助理编辑器 -> 显示助理编辑器)。
然后,在左侧选择相关库后,您将看到该库的“目标成员资格”在右侧显示为复选框列表。
您应该看到列出的应用程序目标,并且应该选中该目标的复选框。
您可以尝试取消选中并重新选中它,将其推入您的项目中?
As extra confirmation that the lib is included in your target, select the lib in the file list in the left pane of Xcode (assuming you've added it to your Target / Project, you should see the framework listed under frameworks), and show the Assistant Editor view on the right pane (View -> Assistant Editor -> Show Assistant Editor).
Then, with the relevant lib selected on the left, you will see 'Target Membership' for that lib shown as a list of checkboxes on the right.
You should see App Target Listed, and the checkbox should be checked for that target.
You could try unchecking and rechecking it, to nudge it into your project?
libiconv
Xcode
->选择正确项目Targets
->构建阶段
->将二进制文件与库链接
->点击+ ->搜索libiconv
->选择找到的libiconv.tbd
libiconv
Xcode
->select correct projectTargets
->Build Phases
->Link Binary With Libraries
-> click + -> searchlibiconv
-> select foundlibiconv.tbd