ios public static const equiv

时间:2012-01-26 16:26:30

标签: ios static constants public extern

我正在尝试完成public static const

的C风格版本

我已经尝试过了:

ClassA.h

  • extern const int FEATURES;

ClassA.m

  • #define THE_CONST 123

ClassB.b

  • #import ClassA.h
  • initWithFrame
    • FEATURES

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

的构建错误

我如何与其他班级分享extern const

1 个答案:

答案 0 :(得分:11)

ClassA.h

  • extern const int FEATURES;

ClassA.m

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