Initialization makes integer from pointer without a cast

Gast #6470467
Lesenswert?

Hallo,
ich habe ein problem mit einer Warnung, die ich gerne weg hätte, aber 
nicht weg bekomme.

file.h
1
typedef enum
2
{
3
  red,
4
  blue,
5
  green
6
}colors_te
7

8
typedef struct
9
{
10
  const colors_te color;
11
  uint8 numbers;
12
}inputInfo_ts;

file.c
1
static infputInfo_ts inputInfo_as[] = 
2
{
3
  {red, 0},
4
  {blue, 0},
5
  {green, 0}
6
}

Die Warnung ist:
initialisation makes integer from pointer without a cast
Dieser bezieht sich auf red, blue und green im struct.

Aber warum castet der überhaupt? Typ soll doch colors_te sein.
Beitrag #6470477 wurde von einem Moderator gelöscht.
Gast #6470482
Lesenswert?

Also ich kriege völlig andere Fehlermeldungen:
1
test.c:6:11: error: expected ‘;’ before ‘typedef’
2
    6 | }colors_te
3
      |           ^
4
      |           ;
5
    7 | 
6
    8 | typedef struct
7
      | ~~~~~~~    
8
test.c:10:9: error: unknown type name ‘colors_te’
9
   10 |   const colors_te color;
10
      |         ^~~~~~~~~
11
test.c:11:3: error: unknown type name ‘uint8’
12
   11 |   uint8 numbers;
13
      |   ^~~~~
14
test.c:14:8: error: unknown type name ‘infputInfo_ts’
15
   14 | static infputInfo_ts inputInfo_as[] =
16
      |        ^~~~~~~~~~~~~
17
test.c:16:3: warning: braces around scalar initializer
18
   16 |   {red, 0}, ...

Du zeigst also nicht den tatsächlichen Code, sondern irgendwas anderes.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren