首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >#包含检测到的错误。请在visual studio代码中更新includePath。

#包含检测到的错误。请在visual studio代码中更新includePath。
EN

Stack Overflow用户
提问于 2021-07-10 06:56:50
回答 1查看 4K关注 0票数 0

我试图在Visual Studio Code How to use C/Cpp extension and add includepath to configurations中编译C++文件,但是我得到了这个错误:

代码语言:javascript
运行
复制
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit.
cannot open source file "iostream"

我已经看到了this question,所有的解决方案都对我起作用了。我还按照visual studio代码教程中的步骤录制了a video。下面是我的代码:

代码语言:javascript
运行
复制
#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World" << endl;
}

下面是我的C/C++设置:

代码语言:javascript
运行
复制
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\x86_64-w64-mingw32\\include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gcc.exe",
            "cStandard": "gnu17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "${default}"
        }
    ],
    "version": 4
}
EN

Stack Overflow用户

发布于 2021-07-10 13:58:37

打开命令pallete (ctrl + shift + P)然后搜索编辑配置,选择C/C++编辑配置(UI)。然后向下滚动,你会看到包含路径,复制包含路径的位置,在文件管理器中找到它,默认位置是C:\Program Files(X86)\mingw-w64.\mingw32\ include。将intellisense设置为默认值。现在你已经准备好享受你的编码之旅了。

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68323394

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档