首页 > 解决方案 > 尝试运行 c++ 文件,但它说 launch.json 需要更新其包含路径

问题描述

尝试在 C++ 中运行一个简单的 hello world 程序,如下所示

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}

但是,它给了我错误:#include 检测到错误。请更新您的includePath. 此翻译单元已禁用 Squiggles

我去了它引导我到的 Json 文件,我显示了这个

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "cl",
            "args": ["-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "/path/to/gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

我对下一步该怎么做感到困惑,如果有人可以提供帮助,将不胜感激

标签: c++visual-studio-code

解决方案


推荐阅读