'How to run program in a pop-out console window using VS Code?

Currently my C++ program runs embedded in the VS Code window, right at the bottom panel. How can I run it in an individual console window as it is in VS?

I tried to turn the "settings/Terminal/Explorer" option "Kind" from "integrated" to "External" but it was no good.



Solution 1:[1]

VS Code for Windows

This is a modified version of the answer by @gino-mempin which allows you to launch an external program from VSCode without having VSCode trying to attach to the launched program (thinking it's a debugger) which could lead to an error after launch. You can optionally configure the launch task to run build tasks prior to launching the external program.

Additional references https://code.visualstudio.com/docs/cpp/launch-json-reference

You FIRST need to install Microsoft's C/C++ VS Code extension before using this launch configuration.

Then configure your launch.json file like this (uncomment any optional parameters which you may need):

{
    "configurations": [
        {
            "name": "Start External Program",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "< the path to your exe to launch >",
            "console": "externalTerminal",
            //"cwd": "optional working directory",
            //"args" : [ "optional arguments", "each argument is enclosed in quotes", "separated by commas" ],
            //"preLaunchTask": "optional name of pre launch build task",
        }
    ]
}

Solution 2:[2]

Actually pretty easy. Open a new window of VS code and open terminal. And copy paste exact command of compiling and running the C++ program. So in this was you have 1 window for code browsing and another from program execution.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rboy
Solution 2 Vinod Kumar