This error was frustrating to fix but turned out it was a teensy tiny error of my own.



I was attempting to send a struct over a radio on Arduino

struct State {
    int x;
    int y;

struct State MyState;


radio.send((uint8_t *)&MyState, sizeof(struct MyState));

So I tried to get the size of an instance instead of the struct itself. No wonder Arduino complained that it couldn't find the struct with the error message of: invalid application ... to incomplete type 'loop()::MyState'.

Also note that & which points to the data, is required to convert the struct into a uint8_t type array for sending. Without it, MyState is a typedef of struct State, and the compiler wouldn't know how to convert a State into a uint8_t.


Convert sizeof(struct MyState) to sizeof(struct State).

Post Note

Note that the image used in this post has nothing to do with the error.