KungA
KungA

Reputation: 29

How to compile and run cpp file using g++ in Visual Studio Code?

I'm trying to use a task, but could only find how to compile:

{
    "version": "0.1.0", 
    "command": "g++",
    "args": ["-Wall", "${file}"],
    "showOutput": "always"
}

I'd also like to print input/output to console when the program is running.

Upvotes: 0

Views: 12595

Answers (1)

Dirk Bäumer
Dirk Bäumer

Reputation: 1191

You might want to have a look at https://code.visualstudio.com/Docs/tasks

At the end there is an example how to setup the task system to use gcc. If you have more than a handful files to compile you might want to think about using a make file and call make instead of gcc directly.

Upvotes: 1

Related Questions