Home > Back-end >  how to make code appear in the terminal ? terminal show also Build finished successfully, Terminal w
how to make code appear in the terminal ? terminal show also Build finished successfully, Terminal w

Time:11-05

enter image description here

It doesn't show me the code output. Should I change the setting or configure something ?

I tried edit task.json and reinstall VScode.

CodePudding user response:

From the screenshot that you shared, to run it from a terminal:

cd /Users/seal/Desktop/projects/cpp
./practice

It seems that you only built the code, that's why it wasn't being executed:

/usr/bin/clang   -fcolor-diagnostics -fansi-escape-codes -g /Users/seal/Desktop/projects/cpp/practice.cpp -o /Users/seal/Desktop/projects/cpp/practice

This command will compile practice.cpp into the executable practice.

You only need to build again when the source code changed.

CodePudding user response:

Open New terminal from options above. Command: g .\practice.cpp it will create .exe file with some name in same folder Command: .<file_name>.exe This will run the file

To make it easy to run program Install "Code runner" extension: It will give to button to run program on top-right. By default, it will give output in Output tab in panel Make few changes, in code runner setting by checking check boxes for 1)'clear previous output' and 2)'Run in terminal' This will run the program in one click without needing to build and run with commands.

  • Related