构建 cocos2d-x 3.15 时出现 Apple Mach-O 链接器错误:“_iconv_open”,引用自:cocos2d::FontAtlas::conversionU32TOGB2312()
Apple Mach-O Linker Error when building cocos2d-x 3.15: "_iconv_open", referenced from: cocos2d::FontAtlas::conversionU32TOGB2312()
我正在努力将现有的 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::__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)
有什么想法可以解决这个问题吗?
构建 Xcode 9.0
谢谢!
更新:通过进一步探索,我发现我需要在我的项目中添加两个新框架:
导航到 Project->Build Phases->Link Binary With Libraries,并添加:
libiconv.tbd
CoreText.framework
解决了我的链接器错误。
将此留在这里以防其他人在从旧版本 cocos2d-x 更新时遇到类似问题。
我正在努力将现有的 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::__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)
有什么想法可以解决这个问题吗?
构建 Xcode 9.0
谢谢!
更新:通过进一步探索,我发现我需要在我的项目中添加两个新框架:
导航到 Project->Build Phases->Link Binary With Libraries,并添加:
libiconv.tbd
CoreText.framework
解决了我的链接器错误。
将此留在这里以防其他人在从旧版本 cocos2d-x 更新时遇到类似问题。