close
The Wayback Machine - https://web.archive.org/web/20240606151755/https://github.com/microsoft/vscode-cpptools/issues/9891
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running C/C++ outputs in debug console instead of terminal #9891

Closed
Heckrexter opened this issue Sep 18, 2022 · 11 comments
Closed

running C/C++ outputs in debug console instead of terminal #9891

Heckrexter opened this issue Sep 18, 2022 · 11 comments
Labels
debugger more info needed The issue report is not actionable in its current state

Comments

@Heckrexter
Copy link

Type: Bug

  1. write the code to execute with print statement
  2. Select the "Run C/C++ file" option
  3. you will see that if there any print statements all of it will happen in the debug console while in the terminal all you see is "executing task", "Starting build" and "Build finished successfully" instead of the output I expect which is "Test out"

Extension version: 1.12.4
VS Code version: Code 1.71.2 (Universal) (74b1f979648cc44d385a2286793c226e611f59e7, 2022-09-14T21:05:37.721Z)
OS version: Darwin x64 21.6.0
Modes:
Sandboxed: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 2, 2, 2
Memory (System) 16.00GB (1.41GB free)
Process Argv --crash-reporter-id dfa5ac12-218d-496d-b79f-7a9d361543d3
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411cf:30557515
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
hb751961:30553087
dsvsc012cf:30540253
azure-dev_surveyone:30548225
2144e591:30553903
vscccc:30566498
fc301958:30567733

@WardenGnaw
Copy link
Member

Do you have externalConsole set to true or false.

The Debug Console is not the output window, it is where diagnostics logging during debugging or using it as an evaluation window.

@WardenGnaw WardenGnaw added debugger more info needed The issue report is not actionable in its current state labels Sep 19, 2022
@Heckrexter
Copy link
Author

Heckrexter commented Sep 20, 2022

Do you have externalConsole set to true or false.

The Debug Console is not the output window, it is where diagnostics logging during debugging or using it as an evaluation window.

I do not know where I can see external console and I am aware debug console is not the output window but for some reason that's the only place where I can see any print statements I put in my codes

@Naaah-man
Copy link

brother if this issue is resolved for you ..can you also enlighten me>?

@Aarushssid
Copy link

What is the solution?

@Heckrexter
Copy link
Author

No solution found so far I just use an extension to run it called "Code Runner"

@Aarushssid
Copy link

Ah, but how are you debugging the code, I dont recall you could debug using code runner?

@Heckrexter
Copy link
Author

I haven't really had to use the debugger, just use some print statements

@Aarushssid
Copy link

Alr thanks

@jSreih
Copy link

jSreih commented Aug 16, 2023

https://www.freecodecamp.org/news/how-to-write-and-run-c-cpp-code-on-visual-studio-code/
I had the same problem, my code kept running in the debugging console. Just follow the steps taken on this website, starting from the images on vscode (assuming you already have vscode installed) and you should be good to run the code right into the integrated terminal using the "run code" option. Hopefully this works for you guys.

@Heckrexter
Copy link
Author

https://www.freecodecamp.org/news/how-to-write-and-run-c-cpp-code-on-visual-studio-code/ I had the same problem, my code kept running in the debugging console. Just follow the steps taken on this website, starting from the images on vscode (assuming you already have vscode installed) and you should be good to run the code right into the integrated terminal using the "run code" option. Hopefully this works for you guys.

That does not fix the problem, it simply bypasses it by using an extension that has been brought up earlier in the conversation.

@F-Stuckmann
Copy link

Just add these to the launch.json config:

"stopAtEntry": true,
"logging": {
                "engineLogging": false, // Show or hide detailed logging from the debug engine
                "programOutput": true, // Show or hide the output of the program being debugged
                "exceptions": true, // Show or hide exception information
                "moduleLoad": false, // Show or hide module loading information
                "trace": false, // Enables tracing of the Debug Adapter Protocol
                "traceResponse": false, // Show responses from the Debug Adapter Protocol
                "warnings": false, // Show or hide warnings from the debug engine
            },

The stop at entry is necessary or a debug help message will pop up at the first breakpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger more info needed The issue report is not actionable in its current state
Projects
None yet
Development

No branches or pull requests

6 participants