error::"setScore": not a member of "GameOverScene"

The GameScene.cpp source file code is as follows:

auto gameoverScene = GameOverScene::create();
Director::getInstance()->replaceScene(TransitionFade::create(1.0f, gameoverScene));

But this line shows an error:


The error is as follows:
1>E:\cocos2d-x-3.17\tests\game3\Classes\GameScene.cpp(130,24): error C2039: “setScore”: not a member of “GameOverScene”
1>E:\cocos2d-x-3.17\tests\game3\Classes\GameOverScene.h(9): message : See declaration of “GameOverScene”

I have declared the setScore function in GameOverScene.h. And the setScore function is defined in the GameOverScene.cpp file. Why is it still showing an error saying “setScore”: is not a member of “GameOverScene”?

The code in the GameOverScene.h file is as follows:

void setScore(int score);

The code in the GameOverScene.CPP file is as follows:

void GameOverScene::setScore(int score)
    _score = score;
auto gameoverScene = GameOverScene::create();

It will return a Scene, right ? I think you must cast Scene to GameOverScene.

Scene* gameoverScene =  GameOverScene::create();


After changing to this, another error is displayed: “class “cocos2d::Scene” has no member “setScore””