I have spent the last hour looking at threads with the same error, but not exactly the same problem, so I decided to ask myself. I am working on part of a project for school. It is a game that has multiple header files and cpp files. I just converted the files to cpp files from c files, and I am working on changing structs to classes (it is required to do so for the assignment).
I am getting the following error: error
Here is my character.h file:
#ifndef CHARACTER_H
# define CHARACTER_H
# include <stdint.h>
# include "dims.h"
# include "dungeon.h"
class character_t {
public:
char symbol;
pair_t position;
int32_t speed;
uint32_t alive;
uint32_t sequence_number;
uint32_t kills[num_kill_types];
};
int32_t compare_characters_by_next_turn(const void *character1, const void *character2);
uint32_t can_see(dungeon_t *d, character_t *voyeur, character_t *exhibitionist);
void character_delete(void *c);
#endif
Here is my dungeon.h file:
#ifndef DUNGEON_H
# define DUNGEON_H
# include "heap.h"
# include "macros.h"
# include "dims.h"
# include "character.h"
class dungeon_t
{
public:
uint32_t num_rooms;
room_t *rooms;
terrain_type_t map[DUNGEON_Y][DUNGEON_X];
uint8_t hardness[DUNGEON_Y][DUNGEON_X];
uint8_t pc_distance[DUNGEON_Y][DUNGEON_X];
uint8_t pc_tunnel[DUNGEON_Y][DUNGEON_X];
character_t *character[DUNGEON_Y][DUNGEON_X];
character_t pc;
heap_t events;
uint16_t num_monsters;
uint16_t max_monsters;
uint32_t character_sequence_number;
uint32_t time;
uint32_t quit;
};
#endif
I know it is a lot to look at, but any idea what is causing this? I am obviously including the dungeon.h header. I have seen mention of circular header inclusions, but I do not understand how to avoid this when both headers need each other.
Edit: I appreciate the help. Your answers were more helpful than an hour or so of searching myself. You fixed my problem before I was even able to trim the content of the message down.