1.直接啟動軟件中心,輸入visual studio code,點擊install即可,千萬千萬不要去裝逼搞什么linux指令安裝,死都不知道怎么死的
2.Visual code是以文件夾為工程目錄的,記得新建一個文件夾例如CPlus
3.寫一個簡單的cpp文件,配置launch.json以及task.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
task.json,這個配了好久,好討厭。注意那個main.cpp需要和你run的文件同名
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "g++",
"args": [
"-g","main.cpp"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
