Xcode 16 错误 - 使用未声明的标识符“_CTYPE_A”

问题描述 投票:0回答:1

我刚刚升级到 Xcode 16.0 和 Sequoia 15.0。我有一个大型的、主要是 Objective-C 的项目,它给了我以下错误。有谁知道我如何追踪这个错误?我很想创建一个示例项目来重现它,但我不知道我的项目的哪一部分正在使编译器走上这条路。其他项目构建良好。

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/wchar.h:67:10: note: while building module '\_wchar' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/wchar.h:67:
#include \<\_wchar.h\>
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/\_wchar.h:76:10: note: while building module '\__wctype' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/\_wchar.h:76:
#include \<sys/\_types/\_mbstate_t.h\>
^
\<module-includes\>:1:9: note: in file included from \<module-includes\>:1:
#import "\___wctype.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/usr/include/\___wctype.h:83:24: error: use of undeclared identifier '\_CTYPE_A'
return (\__istype(\_wc, \_CTYPE_A|\_CTYPE_D));
^

有 100 多行类似错误引用 _CTYPE_A、_CTYPE_C、_CTYPE_D、_CTYPE_G 等。

我已经在另一台仍在运行 Sonoma 的 Mac 上对此进行了测试。该项目在该计算机上使用 Xcode 15.4 进行编译,但使用 Xcode 16 会出现相同的错误。

objective-c xcode
1个回答
0
投票

我通过以下步骤解决了这个问题:

  1. 打开 xcode(您项目的 ios 文件夹或 ios/Runner.xcworkspace)
  2. 选择跑步者
  3. 点击构建设置
  4. 找到“Apple clang - 语言 - 模块”或者您可以只搜索“允许”
  5. 你会看到

允许非模块化包含在框架模块中 - 否

将其更改为“是” enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.