Reputation: 1858
here is the description of the problem.
I have the following class defined..
class classA {
public:
CString aString;
};
extern classA theApp;
in another class function, I do this
theApp.aString = "test string";
then I get the runtime error debug assertion failed, afx.inl line 122; please advise.
I tried to do the allocation inside the class as well but it fails flagging the same runtime error.
class classA {
public:
CString aString;
void set_string()
{
aString = "test string 2";
}
};
extern classA theApp;
//in another class function
theApp.set_string();
visual c++ version: VC++ 6.0
Upvotes: 0
Views: 1787
Reputation: 5920
afx.inl` line 122: ASSERT(m_pchData != NULL); return ((CStringData*)m_pchData)-1; }
It seems, that your theApp
variable is not initialized properly, since its members aString
internal buffer is NULL
, check that you are not making an assignment before its initialization.
Also ensure that you have the latest service pack (SP6) installed for the Visual Studio 6.
Upvotes: 1