code triggered a breakpoint but I set no breakpoint at all

我怕爱的太早我们不能终老 提交于 2019-12-25 12:41:53

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/33204314/code-triggered-a-breakpoint-but-i-set-no-breakpoint-at-all

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!