VScode运行ORBSLAM3

本文介绍如何使用VSCode配置环境并编译ORBSLAM1项目,包括创建c_cpp_properties.json以设置编译选项、tasks.json用于定义构建任务及launch.json实现调试配置。

1. 创建c_cpp_properties.json文件

ctrl + shift + P打开vscode控制台(记住此快捷键,以后经常用),输入C/Cpp: Edit configurations,就自动生成了一个c_cpp_properties.json文件,这样你就可以在该文件中编写参数来调整设置

我的c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/include/eigen3"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

2. 创建tasks.json

ctrl + shift + P打开vscode控制台,输入Tasks: Configure Tasks,再选择Create tasks.json file from templates,选择Others模板,就自动生成了一个tasks.json文件,这样你就可以在该文件中编写参数来调整设置。
我的tasks.json

{
    "tasks": [
        {
            "type": "shell",
            "label": "stereo_test",
            "command": "./build.sh",
            "group": {
                "kind": "build",
                "isDefault": true
            },
        }
        
    ],
    "version": "2.0.0"
}

3. 创建 lunsh.json

vscode自带调试模块,直接点击左侧边栏的Debug图标(Ctrl+Shirft+D),再点上方的齿轮图标configure,就能自动生成launch.json文件

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++ build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/jinln/jinln/c++test/MF-SLAM/Examples/Stereo/stereo_test",
            "args": [
                "/home/jinln/jinln/QTproject/ORB_SLAM3/Vocabulary/ORBvoc.txt",
                "/home/jinln/Desktop/MF-ORB_SLAM3/Examples/Stereo/KITTI03.yaml",
                "/home/jinln/jinln/DATASET/kitti/03",
            ],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "stereo_test",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值