skip to Main Content

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.

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search