Structure in objective c
Getting errors when declaring this structure in objective c.
struct stRs232Struct* pStruct;
pStruct->nMessageId = (int)uMessageId;
Error:Der开发者_如何学Goeferencing pointer to incomplete type
The compiler is warning you that it knows there's a type, but it doesn't know how that type looks like. You most likely have a forward declaration (struct stRs232Struct;
) somewhere but you have not included the complete definition (struct stRs232Struct { ... };
).
What is stRs232Struct? Is it your own structure? If yes then you actually should declare it somewhere. Something like this:
struct stRs232Struct {
int nMessageId;
};
...
struct stRs232Struct* pStruct;
pStruct->nMessageId = (int)uMessageId;
...
If you have already declared it then you should check if the corresponding .h-file with its definition is included before usage.
精彩评论