How to compile your C++ code in Visual Studio Code

undefined or mostly null.
Search for a command to run...

undefined or mostly null.
My dog is very selective in the food he eats. I've already tried different meals, but he raids the bowl only when I put the affordable puppy food in it. Try this food if your pup rejects eating even premium meals.
A blog is compiled for the reforms and changes for the citizens. Althea shows of the buy college papers online are halted for the companies. The series is conducted for the mid and oriental paths or the realm for the citizens for all issues.
where is output?

Pardon?
I wrote this article in December 2023 for an interview screening task and thought to share it today while clearing my drafts for some new content prep, just in case it's still helpful to someone out t

Hey! I’m super excited to announce that I have joined the Secretariat Team at the Digital Public Goods Alliance. In this role, I leverage my passion for open source and technical background to assess DPG applications, provide technical support and ad...

Creative designs have become more important than ever in the software ecosystem today with many industries and end-consumers having several use cases that require them to offer design editing solutions to either designers or end-consumers. Every busi...

With the rise of artificial intelligence (AI) and large language models (LLMs), it has become easier to solve different human problems than ever before. Even consumers with little to no technical expertise can benefit from AI. Humans can now automate...

Some years ago, GitHub introduced the new Profile README feature that allowed GitHub users to pin a markdown file on their profile using a special repository named after their GitHub username. Since then, developers have used this file as a quick por...

C++ is a statically-typed, free-form, (usually) compiled, multi-paradigm, intermediate-level general-purpose middle-level programming language.” In simple terms, C++ is a sophisticated, efficient, and general-purpose programming language based on C. It was developed by Bjarne Stroustrup in 1979.
One of C++'s main features is the compiler. This is used to compile and run C++ code.
A compiler is a special program that processes statements written in a particular programming language like C++ and turns them into machine language or "code" that a computer's processor uses.
I actually wrote this article because I had a C++ assignment that required using a compiler. As usual, everyone was using the CodeBlocks IDE and Visual Studio IDE. But I was already used to Visual Studio Code for all my programming stuff. I then set out to find a way of compiling C++ directly inside my own VsCode Editor and hence this article :).
In this article, I'll show you how to set up your compiler in VsCode and at the end give you some links to some of the best C++ resources.

I would be using a Windows OS throughout this article but I'll provide links to resources that would aid those using other Operating systems.
Now let's get started!
MinGW is a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications.

mingw32-gcc-g++ then select “Mark for Installation”

PATH is an environment variable on Unix-like operating systems, DOS, OS/2, and Microsoft Windows, specifying a set of directories where executable programs are located. In general, each executing process or user session has its own PATH setting. - Wikipedia)
After installing MinGW, it was installed in C:\MinGW\bin. Now you have to include this directory in your environment variable PATH. if you've been using computers for a while now, you should know how to do this already, but if you don't, here are a few resources:
Now we have our compiler set up, let's install Code Runner
Code Runner allows you to Run code snippet or code file for multiple languages:
C, C++, Java, JavaScript, PHP, Python, Perl, Perl 6, Ruby, Go, Lua, Groovy, PowerShell, BAT/CMD, BASH/SH, F# Script, F# (.NET Core), C# Script, C# (.NET Core), VBScript, TypeScript, CoffeeScript, Scala, Swift, Julia, Crystal, OCaml Script, R, AppleScript, Elixir, Visual Basic .NET, Clojure, Haxe, Objective-C, Rust, Racket, AutoHotkey, AutoIt, Kotlin, Dart, Free Pascal, Haskell, Nim, D, Lisp, Kit, and custom command.

#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!";
return 0;
}
Save this file as
test.cpp
Ctrl+Alt+NThe code will run and the output will be shown in the Output Window. Open the output window with `Ctrl+ shortcut.

Ctrl+Alt+MHurray, you just successfully set up your C++ environment in VsCode.
Here's a quick hint: By default VsCode output terminal is read-only, If you're running a code that requires user input like:
#include <iostream>
using namespace std;
const double pi = 3.14159;
void calculate()
{
double area;
double radius;
cout<<"Enter Radius: "<<endl;
cin>>radius;
area = pi * radius * radius;
cout<<"area is: "<<area<<endl;
}
int main()
{
calculate();
return 0;
}
you won't be able to type into the terminal, Cannot edit in read-only terminal.
To fix this, you need to manually enable read-write.
Run in Terminal (Whether to run code in Integrated Terminal) Check the box.OR
setting.json file, add:"code-runner.runInTerminal": true
Hurray, you're done and ready to roll :).
Here are some C++ resources you can use to get started with learning C++
Thank you for reading!