Hi! I'm trying to write an MFC exercise program where a circle is drawn wherever the user clicks in the main frame. I've learned that the document/view way to do this is to store the circle's location in the document, and update it from the view. The problem is when I add private member variables and an accessor function to the CMyAppDoc class, I keep getting a "undeclared identifier" compiler error wherever I reference the members in the function. Here's the relavent parts of my code:
-------------------------------------
// MyAppDoc.h
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDrawDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CDrawDoc();
// My additions are next 3 lines
int m_iCurrX;
int m_iCurrY;
void SetPoint(CPoint point);
// ClassWizard stuff
// MyApp.cpp
// ClassWizard stuff
void SetPoint(CPoint point){
// Undeclared Identifier on next 2 lines
m_iCurrPosX = point.x;
m_iCurrPosY = point.y;
}
----------------------------
I've played around with public, private, and protected variable scopes of different data types with no change, and when I set this same thing up in CMyAppView instead it works fine.
Thanks for any ideas, this is frustrating...
~Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.
-Ben Franklin
-------------------------------------
// MyAppDoc.h
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDrawDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CDrawDoc();
// My additions are next 3 lines
int m_iCurrX;
int m_iCurrY;
void SetPoint(CPoint point);
// ClassWizard stuff
// MyApp.cpp
// ClassWizard stuff
void SetPoint(CPoint point){
// Undeclared Identifier on next 2 lines
m_iCurrPosX = point.x;
m_iCurrPosY = point.y;
}
----------------------------
I've played around with public, private, and protected variable scopes of different data types with no change, and when I set this same thing up in CMyAppView instead it works fine.
Thanks for any ideas, this is frustrating...
~Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.
-Ben Franklin