Ubuntu16.04安装vscode及配置tasjks、tasjks
去官网安装包,
sudo dpkg -i code_1.37.0-1565227985_amd64.deb
下载C++和汉化包
彻底清除卸载vscode,两种方法:
sudo apt-get --purge remove code
sudo dpkg --purge code
helloworld调试:
#include
#include <unistd.h>
using namespace std;
int main()
{
cout<<“Hello World_h”<<endl;
pause();
return 0;
}
1.更改launch.json:
按f5调试,选择第一行,配置launch.json
选择“默认配置”
改成:
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
“version”: “0.2.0”,
“configurations”: [
{
“name”: “(gdb) 启动”,
“type”: “cppdbg”,
“request”: “launch”,
“program”: “
f
i
l
e
D
i
r
n
a
m
e
/
{fileDirname}/
fileDirname/{fileBasenameNoExtension}.out”,
“args”: [],
“stopAtEntry”: false,
“cwd”: “${workspaceFolder}”,
“environment”: [],
“externalConsole”: true,
“MIMode”: “gdb”,
“preLaunchTask”: “build”,
“setupCommands”: [
{
“description”: “为 gdb 启用整齐打印”,
“text”: “-enable-pretty-printing”,
“ignoreFailures”: true
}
]
}
]
}
2.更改tasjks.json
配置好launch。json之后再按f5调试,选择“配置任务”
选择使用模板创建
选择other,打开tasjks.json调试
更改为:{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
“version”: “2.0.0”,
“tasks”: [
{
“label”: “build”,
“type”: “shell”,
“command”: “g++”,
“args”: ["-g", “
f
i
l
e
"
,
"
−
s
t
d
=
c
+
+
11
"
,
"
−
o
"
,
"
{file}", "-std=c++11", "-o", "
file","−std=c++11","−o","{fileBasenameNoExtension}.out”]
}
]
}
成功示范:
参考:https://blog.****.net/weixin_43374723/article/details/84064644?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param