vscode配置C++环境时出现的问题:gcc.exe: error: CreateProcess: No such file or directory

vscode配置C++环境时出现的问题:gcc.exe: error: CreateProcess: No such file or directory

vscode配置C++环境时出现的问题:gcc.exe: error: CreateProcess: No such file or directory_第1张图片

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:\\MinGW\\include\\*",
                "C:\\MinGW\\lib\\gcc\\mingw32\\9.2.0\\include\\**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "compilerPath": "C:\\MinGW\\bin\\gcc.exe",//改这一句
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }      
    ],
    "version": 4
}

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 - 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "task g++"
        }
    ]
}

tasks.json

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "task g++",
            "command": "C:\\MinGW\\bin\\gcc.exe",//改这一句
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd":"C:\\MinGW\\bin"
                //"cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

将"C:\\MinGW\\bin\\gcc.exe"全部均改为"C:\\MinGW\\bin\\mingw32-gcc.exe"后就解决了这个问题,留个记录。

你可能感兴趣的:(问题与解决,vscode)