Linux Manjaro上的Visual Studio代码C ++:IncludePath问题 [英] Visual studio code C++ on Linux Manjaro: IncludePath issue

查看:83
本文介绍了Linux Manjaro上的Visual Studio代码C ++:IncludePath问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Visual Studio代码配置为在Linux Manjaro(最新发行版)上开发C ++代码,但是我有点问题.

I am trying to configure my Visual Studio Code to developing C++ code on Linux Manjaro (last release), but I have a little bit of a problem.

在绿线下,我有以下描述:

Under the green line I had this description:

检测到#include错误.请更新您的includePath.此翻译单元的智能感知功能(/home/waski/myTest/myTest.cpp)将会由Tag Parser提供.无法打开源文件"stddef.h"("iostream"的依赖性)

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (/home/waski/myTest/myTest.cpp) will be provided by the Tag Parser. cannot open source file "stddef.h" (dependency of "iostream")

在c_cpp_properties.json文件的Linux部分中,我具有以下配置:

In c_cpp_properties.json file, section Linux, I have this config:

{
        "name": "Linux",
        "includePath": [
            "/usr/include/c++/7.1.1",
            "/usr/include/c++/7.1.1/x86_64-pc-linux-gnu",
            "/usr/local/include",
            "/usr/include",
            "${workspaceRoot}"
        ],
        "defines": [],
        "intelliSenseMode": "clang-x64",
        "browse": {
            "path": [
                "/usr/include/c++/7.1.1",
                "/usr/include/c++/7.1.1/x86_64-pc-linux-gnu",
                "/usr/local/include",
                "/usr/include",
                "${workspaceRoot}"
            ],
            "limitSymbolsToIncludedHeaders": true,
            "databaseFilename": ""
        }
    },

我还安装了c/c ++扩展名.我认为includePath非常复杂,我也不知道还需要哪个补丁.

I also installed the c/c++ extension. In my opinion, includePath is fully complex, I have no idea, which patch is required also.

推荐答案

我今天遇到了完全相同的问题.这是我的解决方法:

I had exactly same problem today. Here's how I fixed it:

例如通过运行 sudo find/-name stddef.h

我的返回:

/usr/include/linux/stddef.h
/usr/lib/clang/4.0.1/include/stddef.h
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/include/stddef.h

选择这些路径中的任何路径,并将其添加到c_cpp_properties.json文件中,并包含到includePath中.那你应该走了.

Pick any of these paths and add it to c_cpp_properties.json file, into includePath. You should be good to go then.

这篇关于Linux Manjaro上的Visual Studio代码C ++:IncludePath问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆