I have 2 files that use each other in them, so I try to include each of them in each file, which doesn't work because the files would include themselves. I tried putting the relevant include statements inside the header guards, but that makes the compiler think that all the variable names are type identifiers.
Here's what I have when its inside the header guards
//MenuItem.h
#include <SDL.h>
#include <string>
#ifndef MENU_ITEM_H //avoid multiple inclusion
#define MENU_ITEM_H
#include "window.h"
class MenuItem {
bool selected = false;
window containerWindow;
etc
Window.h includes MenuItem.h within it's header guards.
In MenuItem.h I get errors such as
Error 1 error C2146: syntax error : missing ';' before identifier 'containerWindow'
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
When I have them outside the head guards (like so)
//MenuItem.h
#include <SDL.h>
#include <string>
#include "window.h"
#ifndef MENU_ITEM_H //avoid multiple inclusion
#define MENU_ITEM_H
class MenuItem {
bool selected = false;
window containerWindow;
etc
I get the following
Error 1 error C1014: too many include files : depth = 1024
I'm unsure how I can fix it.