gpt4 book ai didi

ios - #define 在 Objective-C 的头文件中

转载 作者:可可西里 更新时间:2023-11-01 05:58:50 27 4
gpt4 key购买 nike

我有一个 Global.h 看起来像

#define NUMBERX 21

在 AppDelegate.h 中,我包含了 Global.h 文件。在 AppDelegate.m 中,我包含了 AppDelegate.h 文件。但是在 AppDelegate.m 中我无法访问 NUMBERX 变量。

ERROR: Use of undeclared indentifier 'NUMBERX'.

如果我在 AppDelegate.h 中定义 NUMBERX,它就可以工作,但我想在我想使用 NUMBERX 变量的所有其他头文件中只包含头文件 (Global.h)。

我该如何解决?

最佳答案

如果您使用 objective-c 标准 #import 来包含您的头文件,请尝试将其替换为“c”#include

关于ios - #define 在 Objective-C 的头文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6585138/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com