#include mess, errors when including a file

Alright so I'm making something, and I've got quite a few .h files. Usually I never really have had issues with them, but right now when I #include spawner.h or AI_Handler.h inside of terrain.h, I get a stream of errors. It says a bunch of classes aren't declared, and that template arguments are invalid. The issue
Main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <algorithm>
#include <string>
#include <SDL.h>
#include <SDL_mixer.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include "characters.h"
#include "load_textures.h"
#include <vector>
#include <ctime>
#include <cstdlib>
#include "camera.h"
#include "renderer.h"
#include "animation_sets.h"
#include "Multi_Piece.h"
#include "AI_Handler.h"
#include "spawner.h"
#include "terrain.h"  

Characters.h
1
2
3
4
5
6
7
8
9
10
11
12
13
#ifndef CHARACTERS_DEF_T
#define CHARACTERS_DEF_T
#include <vector>
#include <SDL.h>
#include <string>
#include "camera.h"
#include "renderer.h"
#include "terrain.h"
#include "load_textures.h"
#include "animation_sets.h"
#include "Multi_Piece.h"
#include <cstdlib>
#include <cmath> 

load_textures
1
2
3
#ifndef LOAD_TEXTURES_FUNCTIONS_T
#define LOAD_TEXTURES_FUNCTIONS_T
#include <SDL.h> 

terrain.h
1
2
3
4
5
6
7
8
#ifndef TERRAIN_DEFINES_THL
#define TERRAIN_DEFINES_THL
#include <SDL.h>
#include <vector>
#include <ctime>
#include <cstdlib>
#include "spawner.h"
#include "AI_Handler.h" 

camera.h
1
2
#ifndef CAMERA_DEFINES_T
#define CAMERA_DEFINES_T 

animations_sets
1
2
3
4
#ifndef ANIMATION_SETS_A
#define ANIMATION_SETS_A
#include <SDL.h>
#include <vector> 

AI_Handler.h
1
2
3
4
5
6
#ifndef AI_DEF_VECT
#define AI_DEF_VECT
#include "SDL.h"
#include "characters.h"
#include <vector>
#include "camera.h" 

spawner.h
1
2
3
4
5
6
7
#ifndef _SPAWNERS_FILE_
#define _SPAWNERS_FILE_
#include "characters.h"
#include <vector>
#include "AI_Handler.h"
#include "SDL.h"
#include "camera.h" 

It's alot sorry, but I have no idea what's causing, so I'm including everything.
Hello tristan1333,

All of your header files start with #ifndef something , but where is your #endif at the end of the file? Another possibility could be the order you have put the header files in main. Maybe it is just me, but I like to include header files with "<>" first and then files with "" second. After that you may be trying to include a header file that depends on another header file first, but is included after.

Hope that helps,

Andy
I've found the issue, I'm trying to make terrain access spawner/AI_Handler, and both of those access characters, and characters has access to terrain. Is there a way to have terrain link to AI_Handler/spawner while retaining the character links? I might have an idea, but if there's some way you're meant to do it, I'd like to find out thanks
You probably need to forward declare something rather than including the entire header. See http://www.cplusplus.com/forum/articles/10627/
Topic archived. No new replies allowed.