I made a class. the header file is :
#pragma once
#include <string>
class Player
{
public:
Player();
private:
};
and the cpp file is :
#include "Player.h"
#include <iostream>
Player::Player()
{
}
When I define a string in the header file and add an argument to the Player function in the header file everything works fine
#pragma once
#include <string>
class Player
{
public:
Player(string name);
private:
string _name;
};
but when I add the same argument to the Player function in the cpp file
#include "Player.h"
#include <iostream>
Player::Player(string name)
{
}
I get an error: identifier "string" is undefined and I get the same error in the header file as well so it effects that too. I tried including string in the cpp file in hopes of solving the problem but it did not work. I'm really desperate for a solution, guys.