C :调试断言失败,AFX.Inl第122行
C++: Debug assertion failed, afx.inl line 122
这是问题的描述。
我有以下类定义..
class classA {
public:
CString aString;
};
extern classA theApp;
在另一个类功能中,我这样做
theApp.aString = "test string";
然后,我得到运行时错误调试断言失败,AFX.inl第122行;请建议。
我也尝试在同类课程内进行分配,但失败了标记相同的运行时错误。
class classA {
public:
CString aString;
void set_string()
{
aString = "test string 2";
}
};
extern classA theApp;
//in another class function
theApp.set_string();
Visual C 版本:VC 6.0
afx.inl`线122: 断言(m_pchdata!= null);返回((cstringdata*)m_pchdata)-1;}
看来,您的theApp
变量未正确初始化,因为其成员aString
内部缓冲区为NULL
,请检查您在初始化之前是否没有进行分配。
还确保您为Visual Studio安装了最新的服务包(SP6)6。
相关文章:
- exe_common.inl中的非法指令
- C :调试断言失败,AFX.Inl第122行
- 如何在 C# 中引用 .inl 和 .h 文件
- 在VS2012单元测试中创建和测试自定义MFC CEdit时,在第21行的afxwin1.inl中断言
- opencv错误:在文件:Mat.inl.hpp第930行的cv::Mat::中断言失败
- Qt - C++ - 致命错误 C1083:无法打开包含文件:"afx.h"
- 如何在模板类中定义模板函数.inl文件
- 非常困惑的模板INL文件
- 'sqrt':对重载函数的不明确调用。\assimp\vector3.inl
- Windows 10/Visual Studio 2015中不支持Afx
- 如何创建一个使用AFX库的混合模式CLR . net DLL