Everything is being redeclared here
Code:
#include "ShopClass.h"
#include "BattleClass.h"
#include <iostream>
void GameManager::Manager()
{
int money = 200;
int lives = 3;
int attack = 0;
int defense = 0;
string ShopBattle;
int Battle;
int Shop;
ShopClass shop;
BattleClass battle;
cout << "Current Status:\n";
cout << "Money: $" << money << "\n";
cout << "Lives: " << lives << "\n";
cout << "Attack Points: " << attack << "\n";
cout << "Defense Points: " << defense << "\n";
cout << "Would you like to visit the shop or battle robots?\n(Please enter either Shop or Battle)\n";
cin >> ShopBattle;
if (ShopBattle == "Shop" || ShopBattle == "shop") {
shop.Shop();
} else if (ShopBattle == "Battle" || ShopBattle == "battle") {
battle.Battle();
} else {
cout << "Error: Invalid Input";
}
}
Code:
from GameManager.h:4,
from robo.cpp:4:
GameManager.h:10: error: redefinition of `class GameManager'
GameManager.h:10: error: previous definition of `class GameManager'
In file included from robo.cpp:4:
GameManager.h:10: error: redefinition of `class GameManager'
GameManager.h:10: error: previous definition of `class GameManager'
These are the kinds of errors header guards are supposed to prevent
Since you're getting them, it means that you didn't implement your header guards properly
Code:
#ifndef GameManager_H_GUARD
#define GameManager_H_GUARD
C++ is case sensitive