Hello,
I have an MFC application that has many different classes which need to access a struct filled with particular values. All of the classes need to have access to these values so I thought that this would be an opportunity to use a global variable in a decent way. However I put the struct declaration
Code:
struct some_struct{
int one;
int two;
int three;
};
in the
Code:
class CMyApp : public CWinApp
header and then make an instance of that struct in the implementation file
Code:
some_struct instanceOfStruct;
However,
Code:
extern some_struct instanceOfStruct;
is only working for me in a few classes and other times it will tell me,
Code:
error C2146: syntax error : missing ';' before identifier 'instanceOfStruct'
error C2065: 'instanceOfStruct' : undeclared identifier
Any thoughts? I know this is poorly worded, and I apologize for that, but I'm just too tired to try and fix it right now. Thank you for any help you might be able to give me. Also, criticism and better ways to do this are welcome.