https://code.visualstudio.com/docs/languages/cpp
首先安装C++插件
然后需要安装一个编译器
编写一段代码
#include<stdio.h>
int main() {
printf("fuck you\n");
return 0;
}
构建:Terminal > Run Build Task
选择G++生成活动文件
上图中的1就是生成的可执行文件
调试
安装codelldb拓展
在这个界面点击添加配置
写入如下配置
{
// 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": [
{
"type": "lldb",
"request": "launch",
"name": "Launch",
"program": "${workspaceFolder}/1",
"args": [],
"cwd": "${workspaceFolder}"
},
]
}
然后运行即可