【问题标题】:ios public static const equivios public static const equiv
【发布时间】:2012-02-19 17:48:51
【问题描述】:

我正在尝试完成 public static const 的 C 风格版本

我已经尝试过做的事情:

ClassA.h

  • extern const int FEATURES;

ClassA.m

  • #define THE_CONST 123

B类.b

  • #import ClassA.h
  • initWithFrame
    • FEATURES

Xcode 不是通过运行时错误,而是通过undefined symbols for architecture i386: "_THE_CONST", referenced from: ... 的构建错误

如何将extern const 分享给其他班级也可以使用?

【问题讨论】:

    标签: ios static constants public extern


    【解决方案1】:

    ClassA.h

    • extern const int FEATURES;

    ClassA.m

    • const int FEATURES = <your const value here>;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 2023-02-22
      • 1970-01-01
      • 2010-09-29
      • 1970-01-01
      • 1970-01-01
      • 2012-12-26
      相关资源
      最近更新 更多