VScode mac C++配置
1. 首先建立task.json
cmd+shift+p
C/C++ Add Debug Configuration, 选择g++/gcc的程序
2. 建立launch.json
插件市场下载codelldb, debug图标 新建launch.json 右下角Add Configuration(如果有的话直接进launch.json) 选择CodeLLDB: Launch
"program": "${workspaceFolder}/<program>"
改为"program": "${workspaceFolder}/${fileBasenameNoExtension}"
添加一行"preLaunchTask": "内容",
内容
为task.json里(编译任务)的label 例如C/C++: g++ build active file
3. debug图标里面 绿色小箭头 选择对应debug名字任务
点绿色小箭头即可开始愉快debug
4. 多文件编译
在tasks.json 里面args参数,-g参数改为"${fileDirname}/*.cpp",
路径有空格 使用单引号 "'${fileDirname}'/*.cpp", // note the placement of the single quotes