Ошибка при отладке кода через cl.exe

для удобства При запуске отладки кода через g++.exe с помощью кнопки в левом углу, ничего не выводится во внутреннюю консоль и не вводится, но если запустить оттуда же cl.exe, то все нормально. Если использовать для запуска отладки кнопку в правом углу, то появляется ошибка(см. на скрине)

Искал решение этой проблемы и пробовал:
Добавить в переменные среды(path) путь к cl.exe
Пытался переписать launch, tasks файлы, но безуспешно, всегда сохранялась эта ошибка

Вот tasks:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "build debug",
      "type": "shell",
      "command": "g++",
      "args": [
        "-g",
        "-O0",
        "${file}",
        "-o",
        "${fileDirname}/${fileBasenameNoExtension}.exe"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "presentation": {
        "reveal": "always",
        "panel": "shared",
        "focus": true
      },
      "problemMatcher": "$gcc"
    },
    {
      "label": "build release",
      "type": "shell",
      "command": "g++",
      "args": [
        "-O2",
        "${file}",
        "-o",
        "${fileDirname}/${fileBasenameNoExtension}.exe"
      ],
      "group": "build",
      "presentation": {
        "reveal": "always"
      },
      "problemMatcher": "$gcc"
    },
    {
      "label": "run",
      "type": "shell",
      "command": "${fileDirname}/${fileBasenameNoExtension}.exe",
      "dependsOn": "build debug",
      "presentation": {
        "reveal": "always",
        "panel": "shared",
        "focus": true
      },
      "problemMatcher": []
    },
    {
      "label": "build with cl.exe",
      "type": "shell",
      "command": "cmd.exe",
      "args": [
        "/c",
        "\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat\" && cl.exe /Zi /EHsc /Fe:\"${fileDirname}\\${fileBasenameNoExtension}.exe\" \"${file}\""
      ],
      "group": {
        "kind": "build",
        "isDefault": false
      },
      "presentation": {
        "reveal": "always",
        "panel": "shared",
        "focus": true
      },
      "problemMatcher": [
        "$msCompile"
      ]
    }
  ]
}

И launch:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Запуск C++",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": true,
      "MIMode": "gdb",
      "miDebuggerPath": "C:/MinGW/bin", 
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true,
        },
        {
          "description": "Skip STL includes",
          "text": "skip -gfile C:/MinGW/lib/gcc/*/include/c++/*",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "build debug"
    }
  ]
}

Я уже без понятия, что переписать или изменить


Ответы (0 шт):