一. 下载VSCODE
-
下载地址https://code.visualstudio.com/
下载.deb文件,双击安装 -
option 安装编译器
sudo apt-get update
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install gdb
- 安装完以后命令行运行
code
二. 安装插件
打开Vs Code搜索安装(Ctrl+Shift+X)
- C/C++
- Code Runner
- CMake
- CMake Tools
三. 配置文件
c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu11",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/devel/lib/visualservo/visualservo",// 更改
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
task.json
{
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make build",//编译的项目名,build,更改
"type": "shell",
"command": "cd ./build ;cmake ../ ;make -j8",//编译命令,更改
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "clean",
"type": "shell",
"command": "make clean",
}
]
}
参考
6. 知乎1 https://zhuanlan.zhihu.com/p/148718585
7. 知乎2 https://zhuanlan.zhihu.com/p/52874931
8. CSDN https://blog.csdn.net/zimuzi2019/article/details/106861692