Theos Xcode9编译成功 Xcode10失败

因为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。但是这样太麻烦了,跪求比较好的解决方案。

Xcode10移除了GCC的stdc++

1 个赞

大神 看到你的帖子了 膜拜。

更新到最新theos后,还是要加入下面两句,Xcode10才能编译通过。

FOOOOOO_CFLAGS = -std=c++11 -stdlib=libc++
FOOOOOO_LDFLAGS = -stdlib=libc++

你好,我也遇到和你同样的.请问这这两句加在哪呢?我加到了Makefile无效

Forest_FILES = AntForest.xm
Forest_FRAMEWORKS = UIKit Foundation
放这里就行
include $(THEOS_MAKE_PATH)/tweak.mk

首先确认你是Xcode10吗 其次在Makefile中你要把F000000改成你工程的名字

如你所说 已经解决 谢谢~

如你所说 已经解决 谢谢了~

抱歉问下这个makefile文件在哪啊。 为什么我在我2.2.6版里找不到啊

2.26是啥玩意的版本

Cocos2DX跟Theos有啥关系?

我理解错了,只看报错了

报错一样的话方法就适用,Xcode里搜索:

  • CFLAGS
  • CXXFLAGS
  • LINKER FLAGS
  • STDLIB
    并作出合适的更改

谢谢大神,果然不报了。哈哈,微博关注你啦~

果然不报了,谢谢各位大神

你的是cocos2dx报错吗?可以教教我怎么改吗?我也遇到xcode10的问题