因为APP要适配iOS12所以把Xcode9.4.1升级到Xcode10,然后编译插件代码,提示如下错误(PS:只是部分错误提示)
==> Preprocessing Tweak.xm…
==> Compiling Tweak.xm (armv7)…
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
While building module 'Foundation' imported from /Users/XXX/theos/Prefix.pch:11:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from <module-includes>:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: fatal error: could not build module
'Darwin'
#include <sys/types.h>
~~~~~~~~^
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
最后找到的解决办法是每次要编译插件代码时,Xcode->preperences->Locations->Command Line Tool选中Xcode9.4.1,要写App时选中Xcode10。但是这样太麻烦了,跪求比较好的解决方案。