A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/microsoft/vscode-cpptools/issues/2889 below:

Unable to establish a connection to GDB when "externalConsole": false · Issue #2889 · microsoft/vscode-cpptools · GitHub

Type: Debugger

(I'm sorry for my poor English)

I want to debug with the built-in terminal on VS Code, so I set "externalConsole": false in launch.json.
But when I started debugging, it told me "Unable to establish a connection to GDB". I have already installed MinGW-w64.

This is my launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C/C++ Debugging with GDB",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "Compile C/C++"
        }
    ]
}

and tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Compile C/C++",
            "command": "g++",
            "args": [
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}.exe",
                "-g",
                "-Wall",
                "-lm",
                "-std=c++17"
            ],
            "type": "shell",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": true,
                "panel": "shared"
            },
            "problemMatcher": {
                "owner": "cpp",
                "fileLocation": "absolute",
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            }
        }
    ]
}

Steps to reproduce the behavior:

  1. Open a c/cpp file
  2. Navigate to Debug panel
  3. Click "Start Debugging"
  4. Error happened.

This error only happens when "externalConsole": false in launch.json. If "externalConsole": true, it will be normal.

starlinq, lanyizi, Utpal29, devdattapandey2512, MagitekKnight and 4 more


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4