   loading w/ C++ error
  Im working on a little hobby text rpg.I have a save and a load function for this and it works but now that im trying implement it. The save implemented correctly but the load doesn't.cout << "Would you like to load a saved character? y/n";cin >> answer;if (answer == 'y')player->Load();it results in the error'player' was not declared in this scopeAny ideas?My functions are all included in a library that is linked to this file through headers.   
  It means exactly what it says. The variable 'player' has not been declared in the current scope. These words are perfectly normal English words; they're used only slightly metaphorically in programming.Basically, what is 'player' supposed to be and where does it come from?   ;player->SetHealth(player->GetMaxHealth());player->SetMana(player->GetMaxMana());cout << "HP: " << player->GetHealth() << " / " << player->GetMaxHealth() << " ";cout << "MP: " << player->GetMana() << " / " << player->GetMaxMana() << "\n" ;player->Save(); works just fine though in the same project.Both have #include "Library.h" which links to my void PLAYER::Save() and PLAYER::Load() functions   ;  Moved to For Beginners.   ;  Just because it is in the same project does not necessarily mean the scope of the variables is always active.//demoint a = 0;{int b = 1;cout << a << b;}//displays 01cout << a << b;//error b is no longer in scope due to } ;  say you have this.int globaldata;void Function1(){    int data1;}void Function2(){    int data2;}main(){   int data3;   data1 = 1; // not in the scope of main and will fail   data2 = 1; // not in the scope of main and will fail   globaldata = 1; // is in the scope of this current file and will be successfule   data3 = 1; // is in the scope of main() and will be successful}If you created the data in one function but are trying to use it in annother it will be out of scope. If you need more help post your code that contains the variables that have the errors.   ;  The function is included in the #include "Library.h"so shouldnt it have the same scope as int globaldata; in your example?   ;  Functions included in the same header do not have sharing scope. You must declare your variable globally or pass it to the function.   ;Quote:Original post by DenzinFunctions included in the same header do not have sharing scope. You must declare your variable globally or pass it to the function.Okay, I believe I understand, thanks. Ill tweek around with it after work and come back with any problems. Thanks for the lessons in scope.   