_iconv linker error help! (RESOLVED)

Hi,
I decided to update my game to the latest cocos.
It is built with 3.7 (on Mac)
So I though I’d go step at a time - so update to 3.8 first.
Replaced by (symbolic linked) 3.7 with 3.8
Clean
Build
And I get

Undefined symbols for architecture x86_64:
“_iconv”, referenced from:
cocos2d::FontAtlas::conversionU16TOGB2312(std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> > const&, std::__1::unordered_map<unsigned short, unsigned short, std::__1::hash, std::__1::equal_to, std::__1::allocator<std::__1::pair<unsigned short const, unsigned short> > >&) in libcocos2d Mac.a(CCFontAtlas.o)
“_iconv_close”, referenced from:
cocos2d::FontAtlas::~FontAtlas() in libcocos2d Mac.a(CCFontAtlas.o)
“_iconv_open”, referenced from:
cocos2d::FontAtlas::conversionU16TOGB2312(std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> > const&, std::__1::unordered_map<unsigned short, unsigned short, std::__1::hash, std::__1::equal_to, std::__1::allocator<std::__1::pair<unsigned short const, unsigned short> > >&) in libcocos2d Mac.a(CCFontAtlas.o)
ld: symbol(s) not found for architecture x86_64

I have tried everything I can find to fix it = with no luck…
If I add -liconv to “Other Linker Flags” for the cocos project - it makes no difference (I currently have -lsqlite3 -lz -liconv as my other linker flags)

Some posts talk about adding libconv.dylib - but I don’t have one of those.

Please help. Cleaning and rebuilding takes ages - and I’m pretty clueless as to what I’m doing here!

:smile:

** UPDATE & RESOLUTION **
Well, it was a case of PEBCAK - I had added the -liconv to the Mac build then built for IOS

Arghhhh!

Hi @Maxxx

I was checking some cocos studio samples recently and found the issue exactly as yours.
the base project was designed back in Cocos 3.2 I believe.

I have added new framework cocos 3.10 and the issue came.
but once I have added -liconv to Other Linker Flags, the errors went and I was able to build successfully.

Please check it once, and let me know, it should work.
may be clean and run, it will take some time but I am sure it will work, tested yesterday.

Regards,
Pabitra

I added -liconv to both my project and the cocos2d_libs project

Still get the _iconv errors

Cleaned, and rebuild many times - even closed XCode and re-opened

If I change back to 3.7 it builds fine

Add libiconv as a framework to your project and you should be all set.

The question is, how do I do this?

Yes, XCode 7.x changed the name.

Interesting.
So I can either include that or add a linker flag -liconv

I will swear I tried adding libiconv.tbd previously with no luck!

Thanks!