How to call function from fileA.cpp in fileB.cpp

Hi @ all,

I have a game.cpp with the function void HelloWorld :: setupScore(){}
This functions show the actual point in my game very well :wink:

Now I created an endScreen.cpp file - the switch via : CCDirector::sharedDirector()->replaceScene(HelloWorld_End::scene()); is also no problem.

Now I want to show the last score at this screen. At the endScreen.h I #import “game.h”
But I ran into error if I call setupScore(); :wink:

So, how it is possible to call and use a function from other files? I’ve seen, that many games use much files to store functions externally.

THX for your help.

@flusenpower
It occurs to me, writing a text file with this information.
Because I’m not sure. If when a scene is replaced, the variables are destroyed.