0

I have problems with the terminal not outputting anything when I run my code, I provided some pictures for guidance. I'm not new to c++ but this is my first time setting up VS code. This is the ; latest version of VS Code. My goal is to have something where I can arbitrarily make code in c++ for practice, and maybe more languages down the road.

enter image description here

enter image description here

Whenever I set "stopAtEntry" to true, the machine terminal will sometimes output, but it's not consistent. And after closing the machine terminal it takes about 17 seconds for it to close. (my computer is new, so is this just a VS code thing?)

When "stopAtEntry" is false, the terminal immediately closes when the program starts.

I'm not sure if I need to adjust this file or even make it. The guy in the tutorial edited it. But it didn't help or worsen the problem. So I might remove it like it was before.

enter image description here

The VS code terminal works fine. It's just the machine terminal that's not working as intended. Oris just simply how compilers work. The only other ones I've tried were Bloodsheed c++ and Net Beans (for Java). Thank you.

drescherjm
  • 10,365
  • 5
  • 44
  • 64
  • 2
    Where in your program do you say "stop and display the results"? Nowhere, thus the program itself does exactly as you commanded it to do -- output and exit immediately. To have it work consistently across any IDE or envrionment, you need to write the code in your C++ program that prevents `main` from returning. There are functions that wait for the user to press a key to proceed -- please research this. – PaulMcKenzie Apr 25 '20 at 00:55
  • 1
    Not an exact duplicate since you are not using Visual Studio (VS Code is a totally different IDE) but related: [https://stackoverflow.com/questions/1775865/preventing-console-window-from-closing-on-visual-studio-c-c-console-applicatio](https://stackoverflow.com/questions/1775865/preventing-console-window-from-closing-on-visual-studio-c-c-console-applicatio) – drescherjm Apr 25 '20 at 01:06
  • That makes sense, thanks guys. – Big Swoll2001 Apr 25 '20 at 22:10

0 Answers0