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 } } ] }