调试程序时,老是出错,有的时候可以调试,但结果出错。
蹦出来的出错提示是:
Debug Assertion Failed!
Program:......
File:afxtempl.h
Line:254
我在程序中使用了CArray。
请问这是什么原因阿

解决方案 »

  1.   

    File:afxtempl.h
    Line:254
    看这个系统文件中的254行,看看是什么地方出错了!
      

  2.   

    AFX_INLINE TYPE CArray<TYPE, ARG_TYPE>::GetAt(int nIndex) const
    { ASSERT(nIndex >= 0 && nIndex < m_nSize);
    return m_pData[nIndex]; }
    这是第254行的内容,我用到了.GetAt()函数,用这个函数会出问题吗?
      

  3.   

    nIndex >= 0 && nIndex < m_nSize
    返回值为FALSE检查nIndex的值
      

  4.   

    明显数组越界了! 取数据确保 index < CArray::GetSize
      

  5.   

    ASSERT(nIndex >= 0 && nIndex < m_nSize);断言失败 说明nIndex不满足(nIndex >= 0 && nIndex < m_nSize);这个条件,检查一下吧
      

  6.   

    可能数组越界;
    ASSERT(nIndex >= 0 && nIndex < m_nSize);表示nIndex >= 0 && nIndex < m_nSize不成立,你传入的Index可能小于0或者大于总数了。
      

  7.   

    for (i=0; i<File1_Count ; i++)
    其中 File1_Count = from_id_1.GetSize();
    所有我觉得没有越界哦
      

  8.   

    我这个程序能连续比较两个文件,直到按下Cancel按钮才退出,第一遍比较的结果都是对的,
    第二遍的结果就错了,比较完一次我就跳用清空的函数,清空的函数是:
    from_id_1.RemoveAll();
    from_id_2.RemoveAll();
    to_id_1.RemoveAll();
    to_id_2.RemoveAll();
    ckt_1.RemoveAll();
    ckt_1.RemoveAll();
    p_1.RemoveAll();
    p_2.RemoveAll();
    把所有的数组都这样处理了
    这样的清空对吗?