I have a global string variable in my cpp file, and am using it in a header file, and it is giving me the C2065 error, when the last time I had this project and created the header file it worked, I made no changes to either file and it is giving me errors for the global variable. It's also giving me the C3861 error while trying to use a global function in the header file declared in the cpp file, when it worked before as well. Everything was normal before I saved and closed my project, but now it's not working at all.
cpp file:
#include "stdafx.h"
#include "header.h"
#include <iostream>
#include <stdlib.h>
#include <string>
#include <windows.h>
using namespace std;
void story(); //--Function Declaration--
void tutorial();
void startGame();
void chooseClass();
void gameMenu();
void exitGame(); //--End Function Declaration--
string name;
string className;
header file:
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
void chooseClass(){
className = "Warrior";
gameMenu();
}
The header file uses the className string variables, and goes to the gameMenu function. The chooseClass function in the header file works without errors.
Errors:
header.h(32): error C2065: 'className' : undeclared identifier
header.h(35): error C3861: 'gameMenu': identifier not found