本文摘自PHP中文网,作者藏色散人,侵删。
vscode不能命中断点如何解决?
vscode c++ 编译生成后,调试时无法命中断点的解决办法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # include <stdio.h>
int g_var = 0;
void print_line(char *str)
{
if (str != NULL)
printf( "%s\r\n" , str);
else
printf( "null string\r\n" );
}
int main (int argc, char **argv)
{
int l_var = 1;
print_line( "hello world!" );
printf( "g_var = %d, l_var = %d.\r\n" , g_var, l_var);
return 0;
}
|
launch.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | {
"version" : "0.2.0" ,
"configurations" : [
{
"name" : "(gdb) Launch" ,
"type" : "cppdbg" ,
"request" : "launch" ,
"program" : "${workspaceRoot}/test.exe" ,
"args" : [],
"stopAtEntry" : false,
"cwd" : "${workspaceRoot}" ,
"environment" : [],
"externalConsole" : true,
"MIMode" : "gdb" ,
"miDebuggerPath" : "C:\\MinGW\\bin\\gdb.exe" ,
"setupCommands" : [
{
"description" : "Enable pretty-printing for gdb" ,
"text" : "-enable-pretty-printing" ,
"ignoreFailures" : true
}
]
}
]
}
|
tasks.json
1 2 3 4 5 6 7 8 9 10 11 12 13 | {
"version" : "2.0.0" ,
"tasks" : [
{
"taskName" : "test" ,
"type" : "shell" ,
"command" : "g++" ,
"args" : [ "-g" , "${file}" , "-o" , "${workspaceRoot}/test.exe" ]
}
]
}
|
编译成功后,在源码中设置断点,却无法命中断点。
阅读剩余部分
相关阅读 >>
sublime与vsCode区别有哪些
vsCode如何添加插件
如何使用vsCode配置启动vue项目
使用vsCode快速创建vue文件模版的方法介绍
vsCode怎么打开浏览器
vsCode怎么新建项目
vsCode如何实现新建文件自动添加作者注释
vsCode中如何新建vue模板?方法介绍
vsCode打不开解决方法
vsCode可以运行c语言吗
更多相关阅读请进入《vsCode》频道 >>
转载请注明出处:木庄网络博客 » vscode不能命中断点如何解决