@implementation classname
static const unsigned int OFFSET_STX =0;
static const unsigned int OFFSET_ETX =1;
static const unsigned int OFFSET_KTX =2;
static const unsigned int OFFSET_MTX =4;
static const unsigned int OFFSET_LTX =5;
static const char STX =0x05;
static const char ETX =0x09;
@end
错误 '__attribute__':预计 '=', '', '', 'ASM' 或 '之前的sizeof'
expected '=', ',', ';', 'asm' or '__attribute__' before 'sizeof'
我如何声明类里面这些静态变量。
我是否需要申报
+(int)OFFSET_ETX
{
return OFFSET_ETX=0;
}
,并通过调用[类名OFFSET_ETX]为每个静态变量。 我有超过10个静态变量要分配在我的程序中。
[错误的可能重复:预期'',',',';','asm'或'__attribute__'''foo']之前(http://stackoverflow.com/questions/990906/iphone-error-expected-asm-or-attribute- before-foo)或[Objective-C错误预期asm或属性之前的类](http://stackoverflow.com/questions/1825597/) – 2011-05-18 03:41:50
@Josh Caswell:我的问题不同于这两个链接。 – spandana 2011-05-18 04:14:04