Xcode有關(guān)lstdc++報(bào)錯(cuò)

報(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
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末鬼店,一起剝皮案震驚了整個(gè)濱河市网棍,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌薪韩,老刑警劉巖确沸,帶你破解...
    沈念sama閱讀 219,539評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異俘陷,居然都是意外死亡罗捎,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,594評論 3 396
  • 文/潘曉璐 我一進(jìn)店門拉盾,熙熙樓的掌柜王于貴愁眉苦臉地迎上來桨菜,“玉大人,你說我怎么就攤上這事捉偏〉沟茫” “怎么了?”我有些...
    開封第一講書人閱讀 165,871評論 0 356
  • 文/不壞的土叔 我叫張陵夭禽,是天一觀的道長霞掺。 經(jīng)常有香客問我,道長讹躯,這世上最難降的妖魔是什么菩彬? 我笑而不...
    開封第一講書人閱讀 58,963評論 1 295
  • 正文 為了忘掉前任缠劝,我火速辦了婚禮,結(jié)果婚禮上骗灶,老公的妹妹穿的比我還像新娘惨恭。我一直安慰自己,他們只是感情好耙旦,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,984評論 6 393
  • 文/花漫 我一把揭開白布脱羡。 她就那樣靜靜地躺著,像睡著了一般免都。 火紅的嫁衣襯著肌膚如雪锉罐。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,763評論 1 307
  • 那天琴昆,我揣著相機(jī)與錄音氓鄙,去河邊找鬼。 笑死业舍,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的升酣。 我是一名探鬼主播舷暮,決...
    沈念sama閱讀 40,468評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼噩茄!你這毒婦竟也來了下面?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,357評論 0 276
  • 序言:老撾萬榮一對情侶失蹤绩聘,失蹤者是張志新(化名)和其女友劉穎沥割,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體凿菩,經(jīng)...
    沈念sama閱讀 45,850評論 1 317
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡机杜,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,002評論 3 338
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了衅谷。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片椒拗。...
    茶點(diǎn)故事閱讀 40,144評論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖获黔,靈堂內(nèi)的尸體忽然破棺而出蚀苛,到底是詐尸還是另有隱情,我是刑警寧澤玷氏,帶...
    沈念sama閱讀 35,823評論 5 346
  • 正文 年R本政府宣布堵未,位于F島的核電站,受9級特大地震影響盏触,放射性物質(zhì)發(fā)生泄漏渗蟹。R本人自食惡果不足惜块饺,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,483評論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望拙徽。 院中可真熱鬧刨沦,春花似錦、人聲如沸膘怕。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,026評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽岛心。三九已至来破,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間忘古,已是汗流浹背徘禁。 一陣腳步聲響...
    開封第一講書人閱讀 33,150評論 1 272
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留髓堪,地道東北人送朱。 一個(gè)月前我還...
    沈念sama閱讀 48,415評論 3 373
  • 正文 我出身青樓,卻偏偏與公主長得像干旁,于是被迫代替她去往敵國和親驶沼。 傳聞我的和親對象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,092評論 2 355