Translate

Thursday, March 6, 2014

Installing minGW on your computer

Greetings everyone :D. Today, I’d like you to take some time to download and install some software; it is safe, but also about 600 mB (so it might be a few minutes, depending on your internet speed). This software I’m talking about is the minGW compiler and Linker for windows. This is a totally different compiler and linker than the one used in visual studios, and it enables you the user to avoid the dependency on the GUI for writing and compiling your code, something I’m trying to accomplish with these tutorials. In this tutorial, I’d simply like you to install and test minGW.

Firsts, Download minGW-get-started.exe ( sourceorge link here : http://sourceforge.net/projects/mingw/ ) This installer makes the process much easier than doing it by command line, and for the sake of simplicity, we will go with this option. This installer isn’t a large download, but it does lead to a much larger download of about 570 mB, all for minGW. This will take a bit of time, so be patience, and install it to the C:\ path for the sake of simplicity (the default path). This will make utilizing minGW much easier.

Once the download process is complete, you should find a new icon on your desktop; this is the actual installer for the minGW bin files. When you run this installer, choose minGW toolkit and g++ (the C++ compiler) from the basic packages(it will choose MSYS automatically), and choose apply changes from the installation tab in the upper left corner. This will start the process of adding and downloading the necessary bin and dll files to your computer. When this part is finished, you can close the installer.

Now this final part is critical, so be careful. You will need to update the environmental variables with the ‘bin’ paths containing the necessary files for gcc. This means going into the control panel, finding the system option, and on the right sidebar, there will be Advanced system settings, select this option. It will open another window, where there is a button at the bottom labeled “Environmental Variables” Choose this option, and in the bottom scroll bar System Variables, find the path option and double click it. This will open another window with variable name and variable value. Now be careful not to remove anything in the value area, because that can cause issues with your computer; navigate with your arrow keys to the right side, and copy and paste (ctrl + c to copy and ctrl + v to paste to avoid using the mouse) the following text command into that value window (including the semi-colon):

 ;C:\MinGW\bin;C:\msys\1.0\bin;C:\MinGW\msys\1.0\bin

This should finish your install process, as windows now knows where the minGW bin files are located. Now go ahead and open console and test the installation for success by entering two commands:

gcc --version
g++ --version

These two commands should output the version date and copyright into the command window, indicating that windows can read the bin files with no issue. This should conclude the installation for minGW, and soon we will work with minGW for more in-depth programming tutorials in C++. Learning to work with multiple compilers is a great way to deepen you knowledge about computer programming, and hopefully you will be comfortable with this in the coming tutorials.

Good luck :D

No comments:

Post a Comment