libiconv not linking to iOS project

sarahhodne picture sarahhodne · Sep 19, 2011 · Viewed 27.9k times · Source

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?

Answer

shuiyouren picture shuiyouren · Apr 2, 2013

You need add libiconv.dylib via "add framework". SRC is available from this discussion.