为什么Visual Studio代码会显示g ++ .exe错误:找不到目录?

时间:2020-08-12 02:23:40

标签: gcc visual-studio-code g++ c++14 mingw32

每当我尝试在Visual Studio代码上编码时,它都会向我显示此错误。我已经根据其官方页面上的给定说明设置了Visual Studio代码。我只是不知道那里是什么问题?请在终端部分查看此错误。帮助我弄清楚我的设置令人沮丧的地方出了什么问题。如果您在Visual Studio代码上设置了c ++,请告诉我。 enter image description here

这是我的task.json

{
"version": "2.0.0",
"tasks": [
    {
        "type": "shell",
        "label": "C/C++: g++.exe build active file",
        "command": "C:\\MinGW\\bin\\g++.exe",
        "args": [
            "-g",
            "${file}",
            "-o",
            "${fileDirname}\\${fileBasenameNoExtension}.exe"
        ],
        "options": {
            "cwd": "${workspaceFolder}"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }
]

}

这是我的launch.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": "g++.exe - Build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "preLaunchTask": "C/C++: g++.exe build active file"
    }
]

}

这是我的c_cpp_properties.json

{
"configurations": [
    {
        "name": "Win32",
        "includePath": [
            "${workspaceFolder}/**"
        ],
        "defines": [
            "_DEBUG",
            "UNICODE",
            "_UNICODE"
        ],
        "compilerPath": "C:\\MinGW\\bin\\gcc.exe",
        "cStandard": "c11",
        "cppStandard": "c++17",
        "intelliSenseMode": "gcc-x86"
    }
],
"version": 4

}

和setting.json

{
"C_Cpp.errorSquiggles": "Disabled"

}

0 个答案:

没有答案