im a noob especially in c++.
I have some problems using a struct that i want to use in some functions.
I looked at the other answers here regarding structs in Header files and .cpp but dont realy get it to work.
my .h file:
namespace game {
class CPlayer{
struct GameData{
int mBoard[8][8];
CBoard &pBoard;
};
public:
CMove Play(const CBoard &pBoard,const CDeadline &pDue);
private:
int GainsFromMoves(struct GameData gameData);
etc.....
then in my .cc file im trying to use this data with:
CMove CPlayer::Play(const CBoard &pBoard,const CDeadline &pDue)
{
GameData gameData;
gameData.pBoard = pBoard;
etc...
where i try to declare the GameData i get an error uninitialized reference member in ‘struct game::CPlayer::GameData’
later trying to usethe GainsFromMoves function i also get some error.
int GainsFromMoves(GameData gameData){
int test = 0;
return test;
}
error: Multiple markers at this line
- expected ‘,’ or ‘;’ before ‘{’ token
- ‘GameData’ was not declared in this
scope
i realize that i probably am doing some really noob error but, i would be very happy for some guidance.