code triggered a breakpoint but I set no breakpoin

2019-09-08 08:34发布

I was running a very simple program in MS visual studio 2015 and set NO breakpoint at all, but the output is:

XXXX.exe has triggered a breakpoint.

I did not set any breakpoint at all. Why would this happen? Thanks.

#include<iostream>

using namespace std;

int main() {
int a = 1;
int b = a + 1;

cout << "b is " << b << endl;

getchar();
return 1;
}

Actually the code works in cpp.sh, so I believe it must have something to do with visul studio setting

updates: I find the exact same problem here: https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/590210#comment-1844444 I also installed the intel compiler. The code runs in debug-x64 mode but not debug-x86 mode. However, I could not add any breakpoints in either mode.

2条回答
家丑人穷心不美
2楼-- · 2019-09-08 08:56

I think you returning a 1 might cause the system to think its a failure, try either returning a 0, or doing void main() and remove the return statement.

查看更多
干净又极端
3楼-- · 2019-09-08 09:05

I think there is still certain incompatibility between intel and MS visual studio. I uninstalled intel stuff from visual studio and now it works.

查看更多
登录 后发表回答