65,209
社区成员
发帖
与我相关
我的任务
分享
我刚刚试了下,debug版本在运行出错时,可以提供错误信息,我故意设置了一个异常,然后运行到异常的时候,就能利用debug版本的错误信息,定位错误位置
#include "stdafx.h"
#include <assert.h>
int _tmain(int argc, _TCHAR* argv[])
{
int a,b;
scanf("%d %d",&a,&b);
assert(NULL);
printf("a+b=%d",a+b);
return 0;
}
提示,在第12行,遇到异常[/quote
当然,信息提示的12行,是在我的编译器中的显示位置,按照贴出的代码看,对应第9行
#include "stdafx.h"
#include <assert.h>
int _tmain(int argc, _TCHAR* argv[])
{
int a,b;
scanf("%d %d",&a,&b);
assert(NULL);
printf("a+b=%d",a+b);
return 0;
}