Debug Assertion failed!

Source: Internet
Author: User
Original Address:Debug Assertion failed! Author:A dream of the low

The VC + + program has the following error:

Debug Assertion failed!
Program:d:wyustuddebugwyustud.exe
File:afx.inl
line:157

Possible problems: 1. Wild pointers; 2. Memory leaks
Workaround:

1. See if you have an ASSERT () or verify () statement in your program. These two macros are used to test whether its parameters are true. Appears you say that this indicates your pointer or expression try to have a problem

2.file:afx.inl
line:157
Just open it and see what happens.

3.vc++ encountered this problem in the release next time to ignore this problem, in fact, is the problem of Wild pointers, released version do not care about this problem, that is, the system to help you to shield, but the problem is still there, the real use, occasionally will come out to you a small mistake. When you create a form, there is no new, but when you delete it in the destructor, you report such an error in the debug environment. Open the "compile"-> Configuration "->" to remove all other options except release, then the widget will be OK
4. First, if you're using a VC6:
A. Press F5 to run your program
B. When an error occurs, select Retry
C. Press Alt+7 to pull up the call Stack window
D. Double-click the most recently defined function from the top down, and the system will automatically display the file where the function is located, at which point the program pauses at the cursor. In general, mistakes are in the vicinity. You can confirm by looking at the value of the variable

5. You can resolve the problem by declaring a temporary CString variable and then acting as a staging, and then putting the value you've obtained into it, then assigning it to another variable that you want to use.

6. It may be that when writing a function call pointer variable, there is no space allocated (if the pointer variable is defined in the class, the pointer allocates space separately when referring to multiple functions), check.
7. A similar problem may be due to the fact that the output object was created unsuccessfully, so that the use of the object was empty, so there was a problem.

8. "Build->clean"

9. "Project"-> "Setting"-> "click->" Category option Preprocessor "
-> "Undefined symbols: Fill in _DEBUG" recompile run

  10. I encountered it when I was doing an ActiveX control, because it was a beginner,
so in one event handler function these frivolous writes:
Classmycontrol Pcontrol;
PCONTROL.F1 ();    These will be the error, after the release, although the exception was blocked, but the direct exit, the solution is to declare an ActiveX control object, but also to create to be created.
Pcontrol.create ("");
Pcontrol.f1 ();     ok!!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.