As you can tell by the title, this error is a nasty one. I have no idea could possibly be causing it. Here is where it is happening:
Problem Area:
#include <SFML/Graphics.hpp>
#include "MainMenu.h"
#include "Globals.h"
Player Player1; // In between here
TroopManager TrMan; // And here
ResourceManager ResMan;
TheCorePassage TCP;
int main()
You probably want to see the constructors now:
Player Constructor:
Player::Player()
{
food = 1000;
foodMax = 2000;
wood = 500;
woodMax = 1000;
stone = 0;
stoneMax = 0;
gold = 0;
goldMax = 0;
population = 0;
populationMax = 10;
populationMaxFinal = 100;
fame = 0;
std::cout << "player" <<std::endl;
}
TroopManager Constructor:
TroopManager::TroopManager()
{
std::cout << "troopmanager" << std::endl;
SlaveID = 0;
SwordID = 0;
PikeID = 0;
ArcherID = 0;
SpearID = 0;
CavalryID = 0;
MastID = 0;
SetUpgrades();
}
Notice how I put a cout statement at the end of Player and the beginning of TroopManager. I have a member inside of TroopManager that spawns units when activated. Well, that member isn't called until way later in the code. BUT! This program think I'm calling the member in between the object delcarations for Player and TroopManager.
Here is how I know. I put a cout statement inside of the member and it outputs Unit Spawned.
When I ran the program, the console window showed me this:
player
Unit Spawned
troopmanager
I put the player cout at the end of the constuctor and the troopmanager cout at the beginning of the second constructor. It's calling the uncalled member in between the two lines. D:
Please Help
If you need more information just say the word.
EDIT:
Here is what is inside of Globals.h
Globals.h
#ifndef GLOBALS_H_INCLUDED
#define GLOBALS_H_INCLUDED
#include "TheCorePassage.h"
#include "ResourceManager.h"
#include "Player.h"
#include "TroopManager.h"
extern Player Player1;
extern TroopManager TrMan;
extern ResourceManager ResMan;
extern TheCorePassage TCP;
#endif // GLOBALS_H_INCLUDED
EDIT:
It's calling the uncalled member in between the two lines. D:
It's actually not even calling the member... It is just creating a unit out of the blue. I tested it with some more cout statements.