Reputation: 87
I'm using a library developed by Xsens in order to use in my project their mti710-GNSS-INS. This library has the following structures (inside the headers xbusmessage.h xbusparser.h)
struct XbusParser {
struct XbusParserCallback callbacks;
struct XbusMessage currentMessage;
uint16_t payloadReceived;
uint8_t checksum;
enum XbusParserState state;
};
struct XbusParserCallback{
void* (*allocateBuffer)(size_t bufSize);
void (*deallocateBuffer)(void const* buffer);
void (*handleMessage)(struct XbusMessage const* message);
};
struct XbusMessage{
enum XsMessageId mid;
uint16_t length;
void* data;
};
In my code, I have a struct XbusParser* xSensBusParser;
as a global variable.
Every time I try to access any field of the "parser struct" I get the following error: error: dereferencing pointer to incomplete type. Below an example code:
bool mti710WakeUp(struct XbusParser* parser, const uint32_t timeout_ms){
mti710ReadData(parser, sizeof(struct XbusMessage));
blockingDelay(timeout_ms, TIME_MS);
return parser->currentMessage.mid == XMID_Wakeup ? true : false;
}
Note that in mti710ReadData
there is a UART Read function that fills a buffer and then a parsing function that changes the parser fields according to the received buffer.
Upvotes: 0
Views: 73
Reputation: 87
As suggested by @Lundin in the comments above, there is a hidden struct definition in xbusparser.c while in the related header file there is only a
struct XbusParser;
So I moved the definition from the .c to the .h file and it works well.
Regards.
Upvotes: 0