0

I build project with Visual Studio and compile by using GCC located in raspberry pi with help of VisualGDB

I have simple c file with structure:

struct labing
{
    lv_obj_t* panel;
    lv_obj_t* label; 
    const char* title;
    int high;
    int width;
};

void createTopPanel(lv_obj_t * screen, labing * lb)
{
...
}

Compiler generates error:

error: unknown type name ‘labing’; did you mean ‘long’?

Looks like compiler doesn't understand structure labing declaration. Why and how to fix it?

vico
  • 17,051
  • 45
  • 159
  • 315

1 Answers1

2

The compiler doesn't understand labing, because there is no labing type, only a struct labing type.

Either use a typedef like this (which will do the typedef and the declaration of the struct):

typedef struct labing
{
    lv_obj_t* panel;
    lv_obj_t* label; 
    const char* title;
    int high;
    int width;
} labing;

or change

void createTopPanel(lv_obj_t * screen, labing * lb)

to

void createTopPanel(lv_obj_t * screen, struct labing * lb)

What you did would compile with C++, but not with C.

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115