Simple setup to run c/cpp and use github on W10

This is a simple guide to setup on your W10 PC an easy way to run c/cpp code, push it on github and use visual studio instead of Vim. I will guide you through each step of the way for an easy and fast setup. It will take us around 30 minutes.

Simple setup cookbook

Ingredients

For the following guide we will need the following ingredients:

  1. Ubuntu on W10
  2. Git
  3. Visual studio

Installing Everything!!

We will need to setup Ubuntu on W10, its a very simple procedure that allows Ubuntu to run on top of W10. Ubuntu can see the filesystem of windows and vice versa (the opposite is a little bit more tricky), but here we will just do the one way road.

  1. First you need to navigate to the windows store and search for ubuntu, I just use the latest version(20.04).
  2. Then you need to do the following: control panel -> Programs -> Turn windows Features on or off -> Navigate to the bottom and activate Windows subsystem for linux.
  3. This will take some time so in the meantime download visual studio and git

When you install everything you will have to restart your PC(expected from windows at this point).

Getting Accustomed

Let's explaining what we installed and how we are going to use them.

  • Visual studio code has some excellent features, such as markdown for each different language, keep tracking of changes in repositories and connecting with compilers. I constantly use visual studio because it lightweight, can connect to remote servers and code remotely, its safe, has excellent default hotkeys and much more.
  • Git is the toolset, it contains everything we need, but why do we also use github? Think of it that way, git are the wheel, every car manufacturer can use them, the implementation differs as well as the use case, which will get us discussing development techniques(agile, waterfall etc.). Git provides the basic commands, github provides some added functionality and the much needed free server.
  • Ubuntu on W10, its a OS build on OS, its not a VM, but its not exactly a stand alone OS as well. We have shared physical space on the hard drive which grants us excellent versatility.

Setup Github ssh

We will use public RSA key for the ssh functionality of github, that way we can pull/push our repositories safely! If you need to understand how that works here is a good read about RSA. The steps go as follows:

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
> Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter] (Enter for default)
> Enter passphrase, you can also leave empty