ubuntu18.04 vscode配置使用

插件外观配置

1 安装拓展:

 2 修改terminal字体:

打开设置

输入font,点击功能-终端,找到如下位置,输入monospace即可。

结果: 

3修改字体颜色:

这里直接推荐想要的theme拓展,比如我喜欢codeblocks的theme,我就搜索对应的拓展安装即可

    "editor.tokenColorCustomizations": {
        // "variables": "#000000", //变量
        // "numbers": "#f96ede",   //数字
        // "strings": "#045ceb",   //字符串
        // "comments": {//注释
        //     "fontStyle": "italic",
        //     "foreground": "#9d9b9b93"
        // },  
        // "keywords": {             //关键字
        //     // 设置字体样式bold 加粗  italic 斜体  underline 下划线
        //     "fontStyle": "bold",
        //     "foreground": "#146e97"
        // }, 
        "functions":{               //函数
            "fontStyle": "bold",

        },
        "types":{                  //类型
            "fontStyle": "bold",
            "foreground":"#359935" 
        }, 
    }, 

或者也可以自定义:

Ctrl + Shift + P

键入settings

打开"settings.json":

{
    "editor.tokenColorCustomizations": {
        "variables": "#000000", //变量
        "numbers": "#f96ede",   //数字
        "strings": "#045ceb",   //字符串
        "comments": {//注释
            "fontStyle": "italic",
            "foreground": "#9d9b9b93"
        },  
        "keywords": {             //关键字
            // 设置字体样式bold 加粗  italic 斜体  underline 下划线
            "fontStyle": "bold",
            "foreground": "#146e97"
        }, 
        "functions":{               //函数
            "fontStyle": "bold",
            "foreground":"#000000"
        },
        "types":{                  //类型
            "fontStyle": "bold",
            "foreground":"#48c023" 
        },  

//-------------------------------------------------------------
        
        "textMateRules": [
            //运算符号,如 +-*/=
            {
                "scope": "keyword.operator", //=等号/赋值号 |= &=
                "settings": {
                    "foreground": "#fb0707",
                }
            },

            //换行符、转义符等如 :\r \n
            {
                "scope": "constant.character.escape", //"\r\n"
                "settings": {
                    "foreground": "#045ceb",
                    "fontStyle": ""
                }
            },
           //标点符号
            {
                "scope": "punctuation",   
                "settings": {
                    "foreground": "#fb0707",
                    "fontStyle": ""
                }
            },
            // 左单双引号
            {
                "scope": "punctuation.definition.string.begin",
                "settings": {
                    "foreground": "#045ceb",
                    "fontStyle": ""
                }
            },
            //右单双引号
            {
                "scope": "punctuation.definition.string.end",
                "settings": {
                    "foreground": "#045ceb",
                    "fontStyle": "" //加粗
                }
            },
        ]

      }
}

.json文件配置

 c_cpp_properties.json

Ctrl + Shift + P

 即可出现文件。

命令行输入:gcc -v -E -x c++ -

然后复制最下面的到.json文件中:(注意要添加引号和/**和逗号)

"/usr/include/c++/7/**",
"/usr/include/x86_64-linux-gnu/c++/7/**",
"/usr/include/c++/7/backward/**",
"/usr/lib/gcc/x86_64-linux-gnu/7/include/**",
"/usr/local/include/**",
"/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/**",
"/usr/include/x86_64-linux-gnu/**",
"/usr/include/**"

再加上"/usr/include/eigen3"即可包含eigen等库(头文件不报错) 

也会有提示了

tasks.json : 

编译器构建 配置文件 ;tasks用于在launch前执行任务,launch用于读取执行文件。

launch.json文件

负责VScode代码的调试

以下是配置orbslam2的例子:

 c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",            //  配置名称可随意更改
            "includePath": [             //运行项目包含.h头文件的目录,在此处添加外部头文件路径
                "${workspaceFolder}/**",
                "/usr/include/eigen3"       
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",   //编译器的路径
            "cStandard": "gnu11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

 tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "./build.sh"
        }
    ]
}

 launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) 启动",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/cch/Desktop/data-slam/ORB_SLAM2-master/Examples/Monocular/mono_kitti",
            "args": ["/home/cch/Desktop/data-slam/ORB_SLAM2-master/Vocabulary/ORBvoc.txt",
                "/home/cch/Desktop/data-slam/ORB_SLAM2-master/Examples/Monocular/KITTI00-02.yaml",
                "/home/cch/Desktop/data-slam/data/00"],
            "stopAtEntry": false,
            "preLaunchTask": "build",//这一步的build与tasks.json中的type名字相同
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

参考:

Ubuntu下 VSCODE ORBSLAM2和3 DEBUG调试_vscode怎么编译orbslam2_hcc-118的博客-CSDN博客

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值