CString m_pchData undeclared in new VC++

I am converting an unmanaged windows MFC app from VC6 to VC8.  I have a class derived from CString.  In it, I reference m_pchData.  In VC6, this was no problem.  In VC8, I get a C2065:'m_pchData':undeclared identifier error.

Has the implementation of CString changed since VC6


Answer this question

CString m_pchData undeclared in new VC++

  • BoseMK

    I have changed the reference to m_pchData to a call to GetString(), and it seems to work great.  Thanks for the help.

  • JTFML

    Yes, CString was hoisted out of MFC and is now sharable outside of MFC.  Could you use CString::GetString()

  • Tomislav B.

    I am referencing m_pchData like so: m_pchData[3] in VC6.
    Also there is a line: AssignCopy(stringSrc.GetLength(), stringSrc.m_pchData); for which I get another identifier not found message. Could you please assist with the appropriate conversions into VC8


  • CString m_pchData undeclared in new VC++