How to fix parsing error of this code in codeblocks?

0

I have a Game class that declares some variables in Game.h and it sets in Game.cpp but when I try to use some .h variable in the .cpp file, the codeblocks says: "error 'counter' is not a member of 'Game' "Here are the two files:

Obs. The code works great but when I put this variable counter and I ordered it to be accessed in udate, it's as if the paper does not accept any other variables, "maybe" error in the file that defines the design of the codeblocks, so if you make a new project and just copy the contents of the two files into files new ones works.

Game.h

======================

class Game{

public:
//...

    void update();

//...

private:

    int counter;

};
======================
#ifndef GAME_H
#define GAME_H
Game.cpp
...

void Game::update(){
Game::counter++;

}

#endif

    
asked by anonymous 09.02.2018 / 14:03

0 answers