用此库,在Debug模式下,编译没问题,
但是执行的时候总是弹出Debug Assertion Failed
窗口,忽略后可以继续运行。
Release模式无此问题
这是怎么回事?

解决方案 »

  1.   

    An ASSERT is used to ensure a certain value or condition meets the
    requirement. It most of the time used to catch programming errors. For
    example I write a method where I rely on the fact that my member has been
    initialised. I then program the line  ASSERT(m_var1 != NULL) before I use
    that member. This way, in the debug version the programm will halt with the
    Assertion Failed Dialog Box and give me the exact line position. I can then
    follow it up and correct the problem as in this example, initialize my
    variable.
    In the Release version of the program this ASSERT will have no effect. If
    my program does not have a problem whith my unititialised member, e.g. it
    does not use it or it initializes it later, then my program works just
    fine. If not you have a crash with little chance of finding it.
    So it's good practice to use ASSERTS, specially for pointers.
    But what when the damn thing happens deep, deep down in the MFC Code ? Now
    that a easy way to find the problem (works most of the time). You run your
    debug version and when it comes to a assert message you press RETRY. The
    debugger will be invoked and points you the position where the assert is
    programmed (Note that the line number is one above the pointer). 
    Normally you want to find out, from where your program delved into this MFC
    Code. Open the Call Stack window and look at the list until you find the
    first name of a method of your application. Double click, and you find the
    caller. Here you need some more initialisation etc..
      

  2.   

    I know what you mean indeed.
    But when I press RETRY,nothing happen.
    Why?
      

  3.   

    assert不应该忽略
    一般可能是因为你使用它的库,有些要注意的条件没有满足,或是用法错误
    简单的忽略,以后可能会有别的问题发生,到时候再调试就麻烦了.
      

  4.   

    错误提示是在
    ..\src\XTGlobal.cpp的line 301出现Assert Invalid.
    我查了一下,出现是在函数void XT_AUX_DATA::LoadSysFonts()内
    // This ASSERT will fire if the system's menu font is a symbol font.
       ASSERT( FALSE );
    我把上面这行注释调,重新编译了Xtreme库,Debug Assertion Failed不再出现了。
    不知道,这会不会有隐患?
      

  5.   

    gz
    Xtreme Toolkit是哪个版本的?
      

  6.   

    我的Xtreme Toolkit版本:v1.94
    我的OS:WINDOWS2000 SP2
    各人遇到过这个问题吗?
      

  7.   

    to panex:
      在DEBUG模式下直接运行Wizard生成的代码,就有这个问题。