libiconv 未链接到 iOS 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7464851/
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
libiconv not linking to iOS project
提问by sarahhodne
I'm trying to compile MailCoreinto 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:
我正在尝试将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
(This is building for the simulator. Building for my iPhone gives the same error, but s/i386/armv7/
).
(这是为模拟器构建的。为我的 iPhone 构建给出了同样的错误,但是s/i386/armv7/
)。
I've tried adding libiconv.dylib
to "Link Binary with Libraries", but it doesn't change the errors at all.
我试过添加libiconv.dylib
到“Link Binary with Libraries”,但它根本没有改变错误。
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?
知道这里有什么问题吗?我一直在尝试使用 Google 搜索此错误,但找不到有关如何在 libiconv 中进行链接的任何信息。既然它是 iOS SDK 的一部分,你会认为我不需要自己编译它吗?
采纳答案by Snips
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).
作为额外确认 lib 包含在您的目标中,在 Xcode 左窗格的文件列表中选择 lib(假设您已将其添加到您的目标/项目,您应该看到框架下列出的框架),并显示右侧窗格中的 Assistant Editor 视图(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.
您应该看到 App Target Listed,并且应该选中该目标的复选框。
You could try unchecking and rechecking it, to nudge it into your project?
您可以尝试取消选中并重新选中它,以将其微调到您的项目中?
回答by shuiyouren
You need add libiconv.dylib via "add framework". SRC is available from this discussion.
您需要通过“添加框架”添加 libiconv.dylib。SRC可从此讨论中获得。