构建cocos2d-x 3.15时,Apple Mach-O链接器错误:“_iconv“开放式”;,引用自:cocos2d::FontAtlas::Conversion32TogB2312()
我正在将现有的cocos2d-x项目从3.7更新到3.15,遇到以下链接器错误:构建cocos2d-x 3.15时,Apple Mach-O链接器错误:“_iconv“开放式”;,引用自:cocos2d::FontAtlas::Conversion32TogB2312(),cocos2d-x,linker-errors,iconv,libiconv,Cocos2d X,Linker Errors,Iconv,Libiconv,我正在将现有的cocos2d-x项目从3.7更新到3.15,遇到以下链接器错误: Undefined symbols for architecture arm64: "_iconv_open", referenced from: cocos2d::FontAtlas::conversionU32TOGB2312(std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::_
Undefined symbols for architecture arm64:
"_iconv_open", referenced from:
cocos2d::FontAtlas::conversionU32TOGB2312(std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> > const&, std::__1::unordered_map<unsigned int, unsigned int, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, unsigned int> > >&) in libcocos2d iOS.a(CCFontAtlas.o)
"_iconv", referenced from:
cocos2d::FontAtlas::conversionU32TOGB2312(std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> > const&, std::__1::unordered_map<unsigned int, unsigned int, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, unsigned int> > >&) in libcocos2d iOS.a(CCFontAtlas.o)
"_CTFramesetterCreateWithAttributedString", referenced from:
_calculateShrinkedSizeForString(NSAttributedString**, objc_object*, CGSize, bool, int&) in libcocos2d iOS.a(CCDevice-ios.o)
"_iconv_close", referenced from:
cocos2d::FontAtlas::~FontAtlas() in libcocos2d iOS.a(CCFontAtlas.o)
"_CTFramesetterSuggestFrameSizeWithConstraints", referenced from:
_calculateShrinkedSizeForString(NSAttributedString**, objc_object*, CGSize, bool, int&) in libcocos2d iOS.a(CCDevice-ios.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
架构arm64的未定义符号:
“_iconv_open”,引用自:
libcocos2d iOS.a(ccfontalas.o)中的cocos2d::fontalas::conversion32togb2312(std:_1::basic_字符串常量&,std:_1::无序_映射&)
“_iconv”,引用自:
libcocos2d iOS.a(ccfontalas.o)中的cocos2d::fontalas::conversion32togb2312(std:_1::basic_字符串常量&,std:_1::无序_映射&)
“CTFramesetterCreateWithAttributedString”,引用自:
_在libcocos2d iOS.a(CCDevice iOS.o)中计算RinkedSizeForString(NSAttributedString**,objc_object*,CGSize,bool,int&)
“\u iconv\u close”,引用自:
libcocos2d iOS.a(ccfontalas.o)中的cocos2d::fontalas::~fontalas()
“CTFramesetterSuggestFrameSizeWithConstraints”,引用自:
_在libcocos2d iOS.a(CCDevice iOS.o)中计算RinkedSizeForString(NSAttributedString**,objc_object*,CGSize,bool,int&)
ld:未找到架构arm64的符号
叮当声:错误:链接器命令失败,退出代码为1(使用-v查看调用)
我该怎么做才能解决这个问题
使用Xcode 9.0构建
谢谢 更新:通过进一步探索,我发现我需要在我的项目中添加两个新框架: 导航到项目->构建阶段->将二进制文件链接到库,然后添加:
libiconv.tbd
CoreText.framework
解决了我的链接器错误
将此保留在此处,以防其他人在从旧版本的cocos2d-x更新时遇到类似问题