VScode:添加头文件路径

F1Ctrl+Shift+p 在弹出的备选选项中选择 C/C++:Edit Configuration(JSON),自动打开c_cpp_properties.json配置文件
VScode:添加头文件路径_第1张图片

在includePath中添加头文件路径

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "~/ros2_install/ros2-linux/**"
                //此处添加需要包含的头文件路径
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

你可能感兴趣的:(工具使用)