【VS Code】开发C++跳转配置

C++配置c_cpp_properties.json

{
    "env": {
        "myIncludePath": [
            "${workspaceFolder}/src/include",
            "${workspaceFolder}/src",
            "${workspaceFolder}",
            "/home/xxx/include/"
        ],
        "myDefines": [
            "RELEASE",
            "MY_FEATURE=1"
        ]
    },
    "configurations": [
        {
            "name": "arm-a40i-linux",
            "compilerPath": "/home/xxx/linux/common/buildroot/host/usr//bin//arm-linux-gnueabihf-g++",
            "compilerArgs": [
                "--sysroot",
                "/home/xxx/linux/common/buildroot/host/usr//arm-buildroot-linux-gnueabihf/sysroot/"
            ],
            "intelliSenseMode": "linux-gcc-arm",
            "includePath": [
                "${myIncludePath}",
                "/home/xxx/linux/common/buildroot/host/opt/ext-toolchain/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/include-fixed/",
                "/home/xxx/linux/common/buildroot/host/opt/ext-toolchain/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/include",
                "/home/xxx/linux/common/buildroot/host/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include/",
                "/home/xxx/linux/out/sun8iw11p1/linux/common/buildroot/host/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include/Qt/"
            ],
            "defines": [
                "${myDefines}"
            ],
            "cStandard": "c11",
            "cppStandard": "c++11",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json",
            "configurationProvider": "ms-vscode.cmake-tools",
            "mergeConfigurations": true,
            "browse": {
                "path": ["${myIncludePath}", "${workspaceFolder}"],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db"
              }
        }
    ],
    "version": 4,
    "enableConfigurationSquiggles": true
}

C++跳转配置settings.json

{

    "clangd.arguments": [

        // 在后台自动分析文件(基于complie_commands)

        "--background-index",

        // 标记compelie_commands.json文件的目录位置

        "--compile-commands-dir=build",

        // 同时开启的任务数量

        "-j=12",

        // 告诉clangd用那个clang进行编译,路径参考which clang++的路径

        "--query-driver=/usr/bin/clang++",

        // clang-tidy功能

        "--clang-tidy",

        "--clang-tidy-checks=performance-*,bugprone-*",

        // 全局补全(会自动补充头文件)

        "--all-scopes-completion",

        // 更详细的补全内容

        "--completion-style=detailed",

        // 补充头文件的形式

        "--header-insertion=iwyu",

        // pch优化的位置

        "--pch-storage=disk"

    ],

    "clangd.fallbackFlags": [

        "-I${workspaceFolder}/include",

        "-I/xxx/opt/ext-toolchain/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/include-fixed/",

        "-I/xxx/opt/ext-toolchain/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/include",

        "-I/xxx/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include/",

        "-I/xxx/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include/Qt/"

    ],

    // "clangd.path": "the/path/to/clangd/executable/on/windows",

    "clangd.detectExtensionConflicts": true,

    "clangd.serverCompletionRanking": true,

    "git.ignoreLimitWarning": true,

    "clangd.path": "/usr/bin/clangd",

    "files.associations": {

        "qobject": "cpp"

    },

    }
参考文档

Ubuntu+Vscode使用Clangd进行项目代码跳转_ubuntu clangd-优快云博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值