Xcode10 libstdc++導(dǎo)致編譯失敗

libstdc++在Xcode10中已經(jīng)移除,蘋果現(xiàn)在用libc++代替libstdc++,那么項(xiàng)目中如果使用了libstdc++改這么辦?
如果是自己工程使用了libstdc++,就用libc++代替。但是如果是第三方使用了,只能等待第三方更新。

但是我們還有一種臨時(shí)解決辦法。

解決辦法

1.從Xcode9中拷貝模擬器和真機(jī)libstdc++庫(kù)

如果嫌麻煩,可以從這個(gè)Git下載

模擬器路徑
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
真機(jī)路徑
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
拷貝下面三個(gè)庫(kù)


image.png

然后復(fù)制到Xcode10下相同路徑下。

這時(shí)候運(yùn)行會(huì)報(bào)錯(cuò)

Reason: no suitable image found. Did find:
/usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator

2.編譯運(yùn)行庫(kù)拷貝

在Xcode9下,從路徑 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib 復(fù)制這三個(gè)庫(kù)到對(duì)應(yīng)的Xcode10相同路徑下。

至此,無論真機(jī)還是模擬器編譯都正常了。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容