vscode c/c++ 调试
main.c
#include <stdio.h> int main(int argc, char const *argv[]) { int a = 10; int b = 20; int c = a +b; printf("c = %d\n",c); return 0; }
Makefile
# CC=g++ CC=clang target: $(CC) -g -o main main.c clean: rm main
生成启动文件

launch.json
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(lldb) Launch main test", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/main", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "lldb" } ] }
打上断点就可以点启动了

浙公网安备 33010602011771号