Sono in fase di dichiarazione delle strutture dati e sto lavorando su 4 files che vi posto:
Info.h :
Infolist.hcodice://sono le info del tree #include "list.h" #ifndef INFO_H #define INFO_H typedef char* Type_Key_Tree; struct S_Sat_Tree { char Razza[15]; float Peso; int Croccantini; Type_List accoppiamenti; }; typedef struct S_Sat_Tree Type_Sat_Tree; struct S_Info_Tree { Type_Key_Tree Key; Type_Sat_Tree Satellite; }; typedef struct S_Info_Tree Type_Info_Tree; #endif
list.hcodice:#ifndef INFOLIST_H #define INFOLIST_H typedef char* Type_Key_List; struct S_Sat_List { char Sesso; int Volte; }; typedef struct S_Sat_List Type_Sat_List; struct S_Info_List { Type_Key_List Key; Type_Sat_List Satellite; }; typedef struct S_Info_List Type_Info_List; #endif
tree.hcodice:#include "infolist.h" #ifndef LIST_H #define LIST_H struct S_List { Type_Info_List Info; struct S_List* Next; }; typedef S_List Type_Node_List; typedef Type_Node_List* Type_list; #endif
main.ccodice:#include "info.h" #ifndef TREE_H #define TREE_H struct S_Tree { Type_Info_Tree Info; struct S_Tree* Right; struct S_Tree* Left; }; typedef struct S_tree Type_Node_Tree; typedef Type_Node_Tree* Type_Tree; #endif
In fase di compilazione ottengo i seguenti errori :codice:#include<stdio.h> #include<stdlib.h> #include "list.h" #include "tree.h" int main() { return EXIT_SUCCESS; }
3 C:\Users\Mario\Desktop\Traccia Semi_inventata\main.c In file included from main.c
11 C:\Users\Mario\Desktop\Traccia Semi_inventata\list.h syntax error before "Type_Node_List"
11 C:\Users\Mario\Desktop\Traccia Semi_inventata\list.h [Warning] data definition has no type or storage class
12 C:\Users\Mario\Desktop\Traccia Semi_inventata\list.h syntax error before '*' token
12 C:\Users\Mario\Desktop\Traccia Semi_inventata\list.h [Warning] data definition has no type or storage class
4 C:\Users\Mario\Desktop\Traccia Semi_inventata\tree.h:1, from main.c In file included from tree.h:1, from main.c
4 C:\Users\Mario\Desktop\Traccia Semi_inventata\main.c from main.c
16 C:\Users\Mario\Desktop\Traccia Semi_inventata\info.h syntax error before "Type_List"
16 C:\Users\Mario\Desktop\Traccia Semi_inventata\info.h [Warning] no semicolon at end of struct or union
24 C:\Users\Mario\Desktop\Traccia Semi_inventata\info.h field `Satellite' has incomplete type
C:\Users\Mario\Desktop\Traccia Semi_inventata\Makefile.win [Build Error] [main.o] Error 1
...che mi sembrava di aver capito fossero dovuti ad un uso di una struttura prima della dichiarazione, ma nel mio caso non riesco a capire dove sbaglio. Un aiuto?

Rispondi quotando
