现象:

 处理:(让vscode知道到哪找头文件)

在.vscode文件夹(找你自己的) 下

创建文件:c_cpp_properties.json,内容如下

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

在includePath中加入对应的路径,${workspaceFolder}/**,是从vscode打开的顶层工作目录下找,我这里是/usr/local目录下

若还找不到,可尝试重启vscode.

​​​​​​​

Logo

更多推荐