報(bào)錯(cuò)信息如下:
Showing Recent Messages
Undefined symbol: std::ios_base::Init::Init()
Undefined symbol: std::ios_base::Init::~Init()
Undefined symbol: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)
Undefined symbol: std::string::assign(std::string const&)
Undefined symbol: std::basic_fstream<char, std::char_traits<char> >::basic_fstream()
Undefined symbol: std::basic_fstream<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)
Undefined symbol: std::basic_fstream<char, std::char_traits<char> >::close()
Undefined symbol: std::basic_fstream<char, std::char_traits<char> >::~basic_fstream()
Undefined symbol: std::string::_Rep::_S_empty_rep_storage
Undefined symbol: std::string::_Rep::_M_destroy(std::allocator<char> const&)
Undefined symbol: std::ostream::tellp()
Undefined symbol: operator delete[](void*)
Undefined symbol: std::istream::tellg()
Undefined symbol: ___cxa_rethrow
Undefined symbol: std::ostream::write(char const*, long)
Undefined symbol: std::__throw_length_error(char const*)
Undefined symbol: ___cxa_end_catch
Undefined symbol: operator delete(void*)
Undefined symbol: ___cxa_guard_release
Undefined symbol: ___cxa_guard_abort
Undefined symbol: ___cxa_pure_virtual
Undefined symbol: std::istream::read(char*, long)
Undefined symbol: ___gxx_personality_v0
Undefined symbol: operator new[](unsigned long)
Undefined symbol: std::string::compare(std::string const&) const
Undefined symbol: vtable for __cxxabiv1::__si_class_type_info
Undefined symbol: std::istream::seekg(long long, std::_Ios_Seekdir)
Undefined symbol: vtable for __cxxabiv1::__vmi_class_type_info
Undefined symbol: std::__throw_bad_alloc()
Undefined symbol: vtable for __cxxabiv1::__class_type_info
Undefined symbol: operator new(unsigned long)
Undefined symbol: std::basic_filebuf<char, std::char_traits<char> >::is_open() const
Undefined symbol: ___cxa_begin_catch
Undefined symbol: ___cxa_guard_acquire
Undefined symbol: std::terminate()
WX20200610-115338.png
這是因?yàn)閄code10徹底廢棄了libstdc++涨薪,相關(guān)的庫文件libstdc++.6.0.9.dylib骑素、libstdc++.6.dylib、libstdc++.dylib刚夺、libstdc++.6.0.9.tbd献丑、libstdc++.6.tbd、libstdc++.tbd也從Xcode10中刪除了侠姑。
最好的解決辦法還是盡快轉(zhuǎn)到libc++開發(fā)
如果還想要繼續(xù)在Xcode10上編譯依賴libstdc++的項(xiàng)目或庫创橄,可以通過把Xcode9中的libstdc++相關(guān)庫文件復(fù)制到Xcode10中即可。
在Xcode9中搜索libstdc++相關(guān)的庫莽红,可以找到四個(gè)相關(guān)的文件:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libstdc++.6.0.9.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libstdc++.6.0.9.tbd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.6.0.9.tbd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libstdc++.6.0.9.tbd
解決辦法
- 1.下載 libstdc文件
-
2.運(yùn)行對應(yīng)的 xcode版本的腳本
image.png
注意點(diǎn): 如果xcode路徑不是腳本中的路徑,需要自行修改
image.png - 3.打開終端cd到libstdc--master文件夾,執(zhí)行sudo sh install.sh妥畏,沒有任何提示即腳本運(yùn)行成功
-
4.重啟Xcode,在TARGETS->Build Phases->Link Binary With Libraries中添加libstdc++相關(guān)的庫安吁,運(yùn)行程序醉蚁,真機(jī)和模擬器都能啟動。
image.png