0

Screen shot of window in debugging mode

Hey, I have a problem with debugger in vscode. I set it according to the vscode dowcumentation I set the debugger correct path but I don't why my debugger stuck at input cin and I tried to give input in base=2 , It unable to perform this action,Anyone please how to give input in debugg mode of cpp/c in vscode usin mingw64. Please resolved my issue.Tell how to provide input in debug mode

Enter base number: *running,thread-id="all"
2
Unable to perform this action because the process is running.
Eric Postpischil
  • 195,579
  • 13
  • 168
  • 312
  • First of all, please copy-paste code *as text* into your questions. Secondly, only select and name the language you're actually program in. C and C++ are *very* different languages. Also please take some time to read [the help pages](http://stackoverflow.com/help), take the SO [tour], read [ask], as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). Lastly please learn how to [edit] your questions to improve them. – Some programmer dude Apr 28 '22 at 06:03
  • That's the debugger console for entering commands onto the debugger, you need to use the terminal window instead – Alan Birtles Apr 28 '22 at 06:05
  • Does this answer your question? [Debug Console window cannot accept Console.ReadLine() input during debugging](https://stackoverflow.com/questions/41195432/debug-console-window-cannot-accept-console-readline-input-during-debugging) – JaMiT Apr 28 '22 at 06:09
  • Or if you prefer something tagged [tag:c++]: [How to read input when debugging in C++ in Visual Studio Code?](https://stackoverflow.com/questions/57494832/) – JaMiT Apr 28 '22 at 06:12
  • thanks all for your help When i run debug mode after setting the value of " external console : true " it pop up with the window and it does take the input too and running successfully, But I want to provide the user input in vscode integrated terminal, Please tell the steps and code too, How can I configure the vscode to take input inintegrated terminal instead of taking in external terminal? – 079_RISHABH Apr 28 '22 at 06:21
  • just set `external console` back to `false` and use the terminal rather than the debug console – Alan Birtles Apr 28 '22 at 07:27
  • Please provide enough code so others can better understand or reproduce the problem. – Community Apr 28 '22 at 18:04
  • @AlanBirtles Yes iI did it but program does not open in integrated terminal after setting externalconsole : false – 079_RISHABH Apr 29 '22 at 05:05

3 Answers3

0

I think that's because it's running in output section ! go to vscde settings and find run in terminal and enable it

Gopal Lohar
  • 133
  • 5
  • But if you go to launch.json setiing yhere you will find externalconsole option which is set to true if I set it true the external terminal won't open then program doest where show where it is running and integrated terminal doesn't run the cpp file. Then how do you configure to set the cpp file run in integrated terminal? – 079_RISHABH Apr 28 '22 at 07:25
0

Firstly, in debugger console do NOT take input at cin or scanf. You shall use terminal for reading in inputs.

1st way: @JaMiT quoted C++ read input by using external console to true.

How do you configure to set the cpp file run in integrated terminal?

2nd way: Check your gcc/g++/gdb version and try to use an more updated version.

In my case, the version goes with mingw-w64 with git bash (GCC 6.2.0) is NOT supported by vscode Integrated Terminal for debugging. However, using an more up-to-date version - GCC (12.2.0) will show your debugging in your integrated Terminal (at least in my case).

Suggested alternative GCC installation: WinLibs - For Standalone GCC

ycohui
  • 66
  • 7
0

I was looking for solution for MacOS. The only working option I found to run debugging in VS Code with internal terminal is to install extension called CodeLLDB.

Here is my launch.json configuration file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "cwd": "${fileDirname}"
        }

    ]
}
deal2k
  • 203
  • 4
  • 12