Im getting this damn error Again! It's really annoying and is really pissing me off honestly. Can you please help show me what is going on with my code. This is
main.cpp
#ifndef PLAYER_H
#define PLAYER_H
//player.h
class Player
{
public:
Player(int Health, int Mana);
~Player();
void Healspell(Player &healing,bool fighting);
bool getbattle();
private:
int Health = 100;
int Mana = 100;
};
#endif // PLAYER_H
Wow that was dry, this is the error (sorry for the lack of information in original post). I am getting a undefined reference from Player::Player() when I tried to call a new function with Player in main.
Also, I would like to know how will I be able to call this.
Your line 52 creates object 'q'. That requires default constructor.
Your class Player has a non-default constructor. Therefore, the compiler will not implicitly add the default constructor. You have to add the default constructor explicitly.
If a function takes a (reference to) Player and a bool as parameters, then you should call it with such parameters. Definitely not with a std::ofstream and a bool, like your current code does.
I don't think that we should start to tell "what is going in your code". It will be much more beneficial to you, if you explain each line of your code to us first.