Returning to C and C++

Since the start of my third year of my Computer Science degree I have not really done much C or C++ programming. My primary programming language at the moment is Java and on the side I am doing some C# work. C++ was the very first programming language that I learnt by myself and during my bachelor’s degree it was the first language along with C that I was taught. There is some stuff that I really like and there is some stuff *cough* pointers *cough* that really annoy me.

With a fairly new laptop (my Surface Book 2), I thought it might be worthwhile to get back into some C and C++ programming. Java and C# are great programming languages but sometimes it is good to go back to your roots and program in a language that is significantly more low level. The attention to detail and level of understanding is significantly higher in C and C++, than Java and C#. If I ever start to feel lazy while programming in Java or C# I think back to how difficult it was to implement some things in C or C++.

I have Visual Studio 2017 installed on my Surface Book 2, but what I really want to do in C and C++ does not require the overhead for the projects that come with using Visual Studio. So instead I am going to use Cygwin (gcc and g++) instead. If you want to use Visual Studio then that is fine but to help others I am going to go into detail about setting up Cygwin so that you can run the gcc and g++ commands to compile and build your C and C++ programs.


Just like on the Cygwin web page “Get that Linux feeling – on Windows“, installing, configuring and using Cygwin is super easy. You can download the 32 or b4 bit versions of Cygwin at the following location. I am going to go over the installation and customization so that you can easily compile and build your C and C++ applications.

Installation Wizard

Once you have downloaded the relevant executable for your OS, run your executable. You should be presented with an installation wizard. Just follow the installation wizard. I used the default settings for the installation. I didn’t change anything and I suggest that you don’t either unless there is a specific reason to. All the paths and command line information presented below assumes the default information.

Note: When you are presented with the following screen on the installation wizard, ignore selecting any package and just press the Next > button. We will be using command prompt to get the necessary gcc and g++ packages.

Cygwin Installation Wizard Select Packages

Continue with the installation wizard and let the dependency download commence. Depending on your download speeds it may take some time to download all the necessary dependencies.

Package Installation

Now one of the very most important components for getting a compiler working outside of using an IDE like Visual Studio is making sure that you have the necessary packages. Open Command Prompt and enter the following in the command line:

setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel

Note: The location of the executable was placed in my Download folder and the command was executed from that directory after I navigated to it.

After you have executed the command, the Cygwin setup should relaunch and it should proceed with the download and installation of the packages that were listed in the command line.


That is it 🙂

The compiler is installed and you can verify this by launching the Cygwin Terminal and entering in the command:

gcc --version


g++ --version

You should see the following displayed on the terminal. The versions of the compilers may be different depending when you install Cygwin and/or if you manually update to an even later version of the compiler (this has not been done here).

Cygwin Terminal Compi;er Versions

To test the compiler out (I’ll be testing the C++ compiler here) we can create a very simple C++ application and use the g++ compiler. The very first C++ program that I ever wrote was a simple Hello World program. What better way to test the installation of the g++ compiler than to use that simple C++ program. Below is the sample code in case you want to start learning C++ and/or you just want to quickly test your compiler but not actually write any code yourself.

#include <iostream>

using namespace std;

int main() {
    cout << "Hello World!" << endl;
    return 0;

Save the above code as HelloWorld.cpp or use your own piece of C++ code and place it in the location of your Cygwin home user directory. By default it should be under C drive, ie. C:\cygwin64\home\<username>.

To compile the C++ code all you need to do is run the following command in the Cygwin Terminal:

g++ HelloWorld.cpp -o HelloWorld

What this will do is create an executable that is called “HelloWorld.exe” that you can then run from either the terminal or straight from the Windows Explorer. If you run the above piece of code in the Cygwin Terminal then the output should match exactly what is shown below; note that the program is waiting on user input before it terminates.

Cpp HelloWorld Terminal Compile And Run

There you go. You now have a Linux like C and C++ compiler installed on Windows and you do not need to have an IDE to compile and build your C or C++ projects. Hopefully this little guide and my desire to go back to C/C++ has fueled your own fire. Enjoy!

Being an Xbox and Windows Insider

After installing a new Xbox OS update on my Xbox One X console, I launched the Xbox Insider application to see what the changes were and if there was any new Quests, Polls, Survey, etc. I noticed that I had been an Xbox Insider for 3 years and 11 months, essentially as soon as there was an option to try the latest features and opt in to new functionality I jumped on it. Along with being an Xbox Insider, I am also a Windows Insider; but I have not been as active in that program in recent months. Checking out the new features and functionality that the teams over at Redmond and around the world working at Microsoft are developing is something that really excites me. I love trying out new gadgets, devices, software, etc. What Microsoft is doing with both their Windows and Xbox platforms, allowing individuals to try new features and provide constructive criticism and feedback is extremely positive and very pro-consumer. It helps ensure that the best product is produced.

However by trying out early builds on either platform is not always fine and dandy. There have been a number of times when simple and basic functionality such as Xbox Live Party Chat did not work at all or installing and/or updating applications completely failed. Luckily to combat this, Microsoft has separated the Insider builds into “Rings” which determine the stability of each build and how new the features you will be getting are. If you are in the Alpha Ring (like I am) then you will get the latest and potentially breaking builds or you could be in the Delta Ring and get a significantly more stable build but not have the newest features. This creates choice for the individual while still allowing them to contribute to the evolution of the platform and assist in bug reporting (something as a software engineer is extremely helpful, the more testers the better). More software companies really need to start providing this feedback process as software is becoming ever increasingly more complex.

Many people will most likely not want to be involved in trying unstable or incomplete builds/features for various reasons. To me though, providing feedback and helping the features become less buggy and complete ready for the masses is rewarding (even though I do not write a single piece of code). To make trying out the new features more enticing and understandable, Microsoft has created Quests and Surveys. Generally if there is new functionality added after an update a new Quest will appear which shows you how to activate and or try it out. It is a very handy way to get your device configured with the new features. The Surveys provide an easy way to communicate how you find the new features (if they even do work as intended) and if there are any issues that you encountered. Reporting bugs and issues is also extremely easy. Each platform as their own Hub that allows you to provide as much detail as possible to help Microsoft resolve your problem, and if others have the same issue then they can piggy back off yours and add further information and diagnostic data.

Overall the entire Insider experience on both platforms has been fun and for someone who is looking to try new features before others, or just wants to help Microsoft out in providing the best possible experience for everyone then the Insider programs are a must. For more information about the Xbox Insiders Program check out the following link. For more information about the Windows Insiders Program check out the following link.