运行后出一对话框:内容大约是这样:Debug Assertion Failed!
  Program: .......\....\MyMFC.exe
  File:afxcmn.inl
  Line:186
  
  For imformation on hwo your progarm can cause an assertion failure, see the Visual C++ documentation on asserts  (Press Retry to debug the application)
...
这种情况怎么知道我程序哪一行代码出错了呢?

解决方案 »

  1.   

    这种情况不能直接定位到你的程序代码,因为程序是运行到File:afxcmn.inl   Line:186
    这里出的问题,但引起该问题的代码还是在你的程序里,在你的程序中设置一些断点,慢慢捕捉。
      

  2.   

    这种处理方式我不推及
    虽然很多断言错误可以忽略
    而且在release版不会出现问题
    但是既然是错误就是有风险的
    所以任何错误或警告我们都应该尽量排除
    至少要了解产生的原因和其能够导致的后果
      

  3.   

    Debug下,调试,call stack窗口,看哪里抛出的异常