I defined a structure in a file.c and I defined a typedef to his pointer in his header. I want to use this typedef in another file.c but it doesnt work. I think that it is a problem with the include of the files.
In the file game.c
#include <stdbool.h>
#include <stdlib.h>
#include "chessSystem.h"
#include "tournament.h"
#include "game.h"
#include "map.h"
#include "player.h"
struct Game_node
{
int game_id;
Game_data game_data;
Game next;
};
In the file game.h I am doing:
typedef struct Game_Node *Game;
And I want to use this struct in another file: tournament.c Into a function I try to define a variable of the type Game. But I cant access to the fields of the struct.
#include "game.h"
..........
Game temp_game=malloc(sizeof(*temp_game));
temp_game->
Important to signal that in the allocation of temp_game the IDE signal an error:Invalid application of 'sizeof' to an incomplete type 'struct Game_node'.
I know that is not very clear. if you have questions tell me.
Thanks you so much.