天天看點

Xcode10報錯 library not found for -lstdc++ 問題解決

在Xcode9上正常編譯的項目,在Xcode10上編譯可能會遇到如下錯誤:

這是因為Xcode10徹底廢棄了

libstdc++

,相關的庫檔案

libstdc++.6.0.9.dylib

libstdc++.6.dylib

libstdc++.dylib

libstdc++.6.0.9.tbd

libstdc++.6.tbd

libstdc++.tbd

也從Xcode10中删除了。

最好的解決辦法還是盡快轉到

libc++

開發

如果還想要繼續在Xcode10上編譯依賴

libstdc++

的項目或庫,可以通過把Xcode9中的

libstdc++

相關庫檔案複制到Xcode10中即可。

在Xcode9中搜尋

libstdc++

相關的庫,可以找到四個相關的檔案:

/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      

但是隻找到了

libstdc++.6.0.9.dylib

libstdc++.6.0.9.tbd

,找不到

libstdc++.6.dylib

libstdc++.dylib

libstdc++.6.tbd

libstdc++.tbd

,前往找到的這4個路徑中會就會發現

libstdc++.6.dylib

libstdc++.dylib

libstdc++.6.0.9.dylib

的替身,

libstdc++.6.tbd

libstdc++.tbd

libstdc++.6.0.9.tbd

的替身:

Xcode10報錯 library not found for -lstdc++ 問題解決
Xcode10報錯 library not found for -lstdc++ 問題解決

是以我嘗試将

libstdc++.6.0.9.dylib

libstdc++.6.0.9.tbd

複制到Xcode10中,并制作

libstdc++.6.dylib

libstdc++.dylib

libstdc++.6.tbd

libstdc++.tbd

這四個替身檔案,但是在模拟器上運作崩潰,自己制作替身的方案不可行,然後我改為了制作副本的方式成功在模拟器上運作。

libstdc++.6.0.9.dylib

libstdc++.6.0.9.tbd

以及制作好的副本

libstdc++.6.dylib

libstdc++.dylib

libstdc++.6.tbd

libstdc++.tb

下載下傳檔案和路徑說明

轉載于:https://www.cnblogs.com/francisblogs/p/9759201.html