开发者

cocoa Expected specifier-qualifier-list before struct

开发者 https://www.devze.com 2023-01-01 08:58 出处:网络
I read the other posted solutions to using structs and resolving t开发者_C百科he \"Expected specifier-qualifier-list before struct\" related errors, but those aren\'t working.Is it different in Object

I read the other posted solutions to using structs and resolving t开发者_C百科he "Expected specifier-qualifier-list before struct" related errors, but those aren't working. Is it different in Objective C? Do I need to declare my struct somewhere else in the class? It gives me the error on the line where I declare the typedef. Here is how it looks right now:

@interface ClassA : NSObject {
    NSString *name;

    typedef struct _point {
        uint32_t x;
        uint64_t y;
    } Point;

    Point a;
}
@end


Put it outside of the interface:

typedef struct _point {
    uint32_t x;
    uint64_t y;
} Point; 

@interface ClassA : NSObject {
    NSString *name;
    Point a;
}
@end
0

精彩评论

暂无评论...
验证码 换一张
取 消