VSCode 配置笔记

一. 下载VSCODE

  1. 下载地址https://code.visualstudio.com/
    下载.deb文件,双击安装

  2. option 安装编译器

sudo apt-get update
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install gdb
  1. 安装完以后命令行运行
code

二. 安装插件

打开Vs Code搜索安装(Ctrl+Shift+X)

  1. C/C++
  2. Code Runner
  3. CMake
  4. 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值