JHHK

欢迎来到我的个人网站
行者常至 为者常成

(-lstdc++.6.0.9)找不到问题

目录

-lstdc++.6.0.9

xcode10已经废弃了libstdc++.6.0.9和libstdc++库,使用libc++库来替代。 所以在xcode10中编译工程时,若工程中用到了libstdc++.6.0.9和libstdc++库,那么编译器就会报链接错误。

ld: library not found for -lstdc++.6.0.9
clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决方案

一、工程或三方库不依赖这两个库的情况

可能之前存在第三方依赖libstdc++.6.0.9或libstdc++,当第三方移除后未及时移除对这两个库的引用,这种情况下直接删除libstdc++.6.0.9和libstdc++的引用,重新运行,问题解决。

二、工程中用到这两个库

方案一:拷贝

Xcode9中拷贝 -lstdc++.6.0.9以及libstdc++等库到Xcode10中,真机和模拟器都需要拷贝。

真机路径:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib

模拟器路径:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib

方案二:替换苹果支持的libc++

将工程中依赖-lstdc++.6.0.9和libstdc++库替换为libc++,注意使用的第三方库若依赖-lstdc++.6.0.9和libstdc++库也要替换。


行者常至,为者常成!





R
Valine - A simple comment system based on Leancloud.