在 Xcode 中使用 djinni 时"use of undeclared identifier" 'noreturn'

"use of undeclared identifier" 'noreturn' when using djinni in xcode

本文关键字:identifier Xcode noreturn undeclared of djinni use      更新时间:2023-10-16

我正在使用一个名为 djinni 的库,它连接到我的 iOS 代码,并允许我在 iOS 和 Android 中运行相同的 c++ 代码。 我遇到的问题是我已将其附加到我正在处理的旧 xcode 项目中,并且在 djinni 代码中出现错误。

我看到 4 个错误,所有错误都是"使用未声明的标识符'noreturn'"

可以看到这些示例的一个例子是:

namespace djinni {
// Throws an exception for an unimplemented method call.
[[noreturn]] void throwUnimplemented(const char * ctx, NSString * msg);
// Helper function for exception translation. Do not call directly!
[[noreturn]] void throwNSExceptionFromCurrent(const char * ctx);
} // namespace djinni

带有"[[noreturn]]"的两行都会引发此错误。是否有我忽略的项目设置?我的 main.m 已重命名为 main.mm,所有 djinni 编译源代码都添加了 -fobjc-arc。

将 c++ 语言方言更新为 -std=c++14 修复了此问题