Tengo problemas para asignar variables a las estructuras, especialmente al hacer una matriz de estructuras, con el compilador XC8.
Código de ejemplo a continuación:
typedef struct p{
int id;
dateStamp start;
dateStamp stop;
int parent_id;
} period;
period p1 = {1, {0, 0, 0, 1, 1, 14}, {20, 0, 0, 1, 1, 14}, 1};
period p2 = {1, {21, 0, 0, 1, 1, 14}, {50, 0, 0, 1, 1, 14}, 1};
period p3 = {1, {51, 0, 0, 1, 1, 14}, {59, 0, 0, 1, 1, 14}, 1};
period periods[3] = {p1, p2, p3};
Y este es el registro de errores del compilador:
main.c:233: error: (188) constant expression required
main.c:233: error: (207) simple type required for "@"
main.c:233: error: (182) illegal conversion between types
struct p -> int
main.c:233: error: (181) non-scalar types can't be converted to other types
main.c:233: error: (188) constant expression required
main.c:233: error: (207) simple type required for "@"
main.c:233: error: (182) illegal conversion between types
struct p -> int
main.c:233: error: (181) non-scalar types can't be converted to other types
main.c:233: error: (188) constant expression required
main.c:233: error: (207) simple type required for "@"
main.c:233: error: (182) illegal conversion between types
struct p -> int
main.c:233: error: (181) non-scalar types can't be converted to other types
main.c:256: warning: (345) unreachable code
(908) exit status = 1
make[2]: *** [build/default/production/main.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
Las sugerencias serían bienvenidas ....