Unable to create or use a class variable from an #include header file. The code is:
# include "header/Gawk.h" // exists: I can "go to document" using namespace std; // exists using namespace gawk; // can't find,namespace (C2871) Gawk* g; // can't find class 'Gawk'(C2143)
I don't know why the Gawk.h header file is not recognized. Does it have to be in the same folder as this header file? Not recognizing the header file explains why Gawk* g isn't legal, but doesn't explain the C2143 error.
The C2871 error (can't find namespace) is because the Gawk.h header is not recognized.
The C2143 is a real head scratcher. The message is "syntax error: missing ';' before '*', which makes no syntactic sense.
I would like to create a pointer or reference to a class object in a header file, and then use this reference throughout the application. I would like to assign a value to this variable in an object separate from its definition. In this case, 'g' is defined in Global.h and assigned a value elsewhere and used throughout. Any idea how to do this?