Skip to main content
gamedev.net
🔒 Locked

[c++] assert

Started by 16bit_port 3 replies 4.2k views
Original Post
16bit_port
16bit_port
Normally if an assert is triggered, a dialog should pop up and show the expression, filename, and line number.

If I do something as simple as :
#include <assert.h>int main(){    assert( 1 == 0 );    return 0;}


I get the dialog showing up with the following message :

"Debug Error!
R6010
- abort() has been called
(Press Retry to debug the application)"

and a command prompt displaying the desired message :
"Assertion failed : 1 == 0, ..., line 5"

How can I get it the dialog to NOT say abort has been called and instead have it show the assertion message?

I'm using VS 2010 and I created the project as a win32 console application.

Thanks.


SiCrane
SiCrane
Change the project from a console project to a Windows project.
16bit_port
16bit_port
Yes but I would to keep it as a console project.
SiCrane
SiCrane
It's possible to use the console in a Windows project: see the AllocConsole() function.
Sneftel
Sneftel
#include and _set_error_mode(_OUT_TO_MSGBOX), apparently.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.