Visual Studio Embedded Terminal Does Not Display Text

I am new to MacOS and I am trying to set up a programming environment and my IDE is Visual Studio Code. When a program launches it, by default it prints on output. However, a request for data collection fails. The online solution I found for this is code output through the terminal, but now nothing is displayed in the terminal.

I am posting it here instead of reporting an error since I am not sure if the error is mine or a program.

Here is a simple code I'm trying to run:

#include <iostream>

int main()
{
    int i;
    std::cout << "Enter a number: ";
    std::cin >> i;
    std::cout << "\n" << i;
    return 0; 
}

When passing through the output, it displays the first part, then a failure when prompted for input. When passing through the terminal, the terminal displays only "cd" (directory location) "& g ++ main.cpp -o main & &" (directory location) "main" and nothing else.

Below are my tasks. json and launch.json:

tasks.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "c++ test program",
            "type": "shell",
            "command": "g++",
            "args": [
                "-g", "main.cpp"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

launch.json:

{
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(lldb) Launch",
                "type": "cppdbg",
                "request": "launch",
                "program": "${workspaceRoot}/a.out",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceRoot}",
                "environment": [],
                "externalConsole": true,
                "MIMode": "lldb"
            }
        ]
    }

The only parameter that has been changed will be "code-runner.runInTerminal", which is set to true.

+4
source share
1 answer

Code Runner :
Code Runner, Ctrl+,, , code-runner.runInTerminal code-runner.runInTerminal true, :

{
    "code-runner.runInTerminal": true
}

.
, .

+1

Source: https://habr.com/ru/post/1686526/


All Articles