I have two header files, and I need some of the variables from header file 1 in header file 2.
Here is some info to help.
int SelRace, ...
char Race[80], ...
These two are from header file 1, and I need these values in header file 2 to follow if() statements.
In header file 1, SelRace is assigned 1, 2, or 3, and I’m trying to call on it again after that’s been done. Here is where it is needed in header file 2.
while (1)
{
if(SelRace == 1)
{
cout << "[text here]" << endl;
}
else if(SelRace == 2)
{
cout << "[text here]" << endl;
}
else if(SelRace == 3)
{
cout << "[text here]" << endl;
}
else
{
cout << endl;
}
}
Race[80] will be reprinted at various points in the [text here] as I have yet to fill those in. Depending on the value of SelRace, Race[80] also had a different string written to it.
So how do I do this?
You should
.cppas opposed to a.has you are doing now..h.hin the 2nd.cppStep 2 and 3 can be merged by declaring them as extern in the
.cppas billz suggests, depends on how widely you expect to use those globals.