The quickest way to set up C++ on Windows

Let's say you have a new Windows laptop or a new VPS and you just want a quick, short and sweet set-up so that you can compile and run some C++ code in a minute.

Here is how you do it.

First, download VS Code. When you are done, create a new file main.cpp and type a few simple C++ lines. Some hello world stuff.

VS Code will prompt you to install the C/C++ extension. Do it. Then install one more extension called Code Runner.

Then you need a g++ compiler for windows which can be downloaded here

Install it and set it up on the path. Here is how. Click on start on Windows, type "envir" and you will see a control panel with Edit System Environment Variables.

Click on it.

You will see a System Property panel, click Environment Variables.

Then down below choose Edit.

And lastly, click New and add the path to cygnus binaries (which is by default C:\cygnus\cygwin-b20\H-i586-cygwin32\bin)

Click OK.

That is all.

Now close and reopen your VS Code with the cpp file. Click the right mouse button and you will Run Code. Click it and your cpp code will be translated and it will run.

(Sure you can - and probably should if you are serious about C++ development - install Visual Studio Community IDE for C++, but it takes much longer, sometimes even hours to complete.)