MFC app error C2065: 'theApp' : undeclared identifier
Posted on 2016-07-26
I have an MFC dialog based application in Visual Studio 2008, which we will call MyApp. It contains several other dialog/classes for specific purposes. In the MyApp.h file I do have extern MyApp theApp; declared at the bottom of the header file.
The problem is that all of the sub dialog classes will recognize the theApp global definition except one. For some reason I get a compile error "error C2065: 'theApp' : undeclared identifier" in this specifica dialog class. With the global definition present, and the other 6 dialog classes receognizing it just fine, for some reason this one does not. This dialog and class were created normally through the MFC, not imported as an 'existing item'.
I just don't understand why I have this problem in this particular dialog class. Any insight on this, and how I can resolve it would be appreciated.