Fedora 29配置 Vscode 出现#include errors detected. Please update your includePath. IntelliSense

问题描述: Linux(此处为Fedora 29)下vscode配置C语言或者C++开发环境后,编写代码,在头文件上有绿色波浪线,并报错#include errors detected. Please update your includePath. IntelliSense features for this translation unit (/home/flanwu/Vscode/C++/test.cpp) will be provided by the Tag Parser.cannot open source file “bits/c++config.h” (dependency of “iostream”)

截图如下

在这里插入图片描述

默认c_cpp_properties.json

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

在尝试了N多种方法后,基本上都是围绕c_cpp_properties.json文件中库的引用而展开的,我试过后,都没用,最后在千辛万苦的查找后,我怀疑是我文件导入问题,我查看了vscode的官方解决办法,就是下面连接中的,不幸的是,是mac配置

官方解决办法

解决方法:我尝试过,因为C库是在/usr/include/下面,如

在这里插入图片描述
于是我尝试添加库来实现

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

但是仍然没有解决问题。这时候,我冷静想了下,官网的格式有问题??,库还是没有导入,此时我看到下面"${workspaceFolder}/**"这个,我突然明白了,如果格式相同,应该目录导入是这样的

"/usr/include/**",

而不是这样

"/usr/include/"

更改后,终于解决了问题.

最后附上完整c_cpp_properties.json文件配置

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "/usr/include/**",
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}
posted @ 2019-03-17 19:18  没尾巴的刺刺鱼  阅读(536)  评论(0编辑  收藏  举报