0

I don't what happened to my vscode all of a sudden I am not able to debug files although I am to run my CPP program but not able to debug please help me I spend 2-3 hours continuously trying to fix my debugger

my program is running fine and compiler is creating a exe file as shown below enter image description here

when I hit the debug button this image appears enter image description here

and then it stuck on this screen enter image description here

when I press any kind of key it exits and the normal terminal window appears enter image description here

it is just like it is trying to open the external terminal but not able to open it some how this is what i think spending a whole day solving this problem

Lauch.json file

{
    // 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": "${fileDirname}",
            "environment": [],
            "externalConsole": true,
            "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"
        }
    ]
}

Task.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\MinGW\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: C:\\MinGW\\bin\\g++.exe"
        }
    ]
}
7
  • 4
    Looks like you have Visual Studio Code, not Visual Studio. If this is your intent, carry on with the question. If you wanted to use Visual Studio, you got the wrong download, I'm afraid. Here's the right one Commented Aug 16, 2021 at 19:28
  • 2
    What exactly is the problem? What happens when you try to debug? Commented Aug 16, 2021 at 19:34
  • You will have to give us more information on what happens and what steps you have done to try to figure out why. Your config files look fine. Commented Aug 16, 2021 at 20:36
  • Maybe you unwittingly activated the option that automatically closes the execution window when the program ends? Try setting a breakpoint somewhere in your code and see if you can reach it, that will narrow down the potential issues. And by the way, you have an amusing typo on "pops up" ;) Commented Aug 17, 2021 at 6:50
  • @kuroineko no bro that doesn't work i don't know what happen all of a sudden day before yesterday it was working absolutely fine and yesterday when i tried to debug a simple program it just didn't run at all Commented Aug 17, 2021 at 7:56

2 Answers 2

1

Deleting the

  1. %USERPROFILE%.vscode\extensions\ms-vscode.cpptools-1.6.0-insiders\install.lock
  2. %USERPROFILE%.vscode\extensions\ms-vscode.cpptools-1.6.0-insiders\debugAdapters

worked for me. Windows 10

for more information Please see: https://github.com/microsoft/vscode-cpptools/issues/7971

Sign up to request clarification or add additional context in comments.

Comments

0

Try add -g to flags. -g is flag to enable debugging.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.