a compiler is a computer program that translates computer code written in one [programming language (the source language) into another language (the target language).
If you are reading this tutorial, I’m guessing I do not have to explain much about compilers and programming languages. For this tutorial, we are going to install C/C++
compiler using MinGW64
tool.
MinGW provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs. (It does depend on a number of DLLs provided by Microsoft themselves, as components of the operating system; most notable among these is MSVCRT.DLL, the Microsoft C runtime library. Additionally, threaded applications must ship with a freely distributable thread support DLL, provided as part of MinGW itself).
MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes. MinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows.
Primarily intended for use by developers working on the native MS-Windows platform, but also available for cross-hosted use MinGW includes:
- A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;
- GNU Binutils for Windows (assembler, linker, archive manager)
- A command-line installer, with optional GUI front-end, (mingw-get) for MinGW and MSYS deployment on MS-Windows
- A GUI first-time setup tool (mingw-get-setup), to get you up and running with mingw-get.
Installing MinGW
First, navigate to the MinGW
site to download the installer binary: http://win-builds.org/doku.php
Download the win-builds-1.5.0.exe
file and launch the executable.
Next, select Native Windows
and x86_64
to start the installation process. - May require administrative privileges.
The next step is to select the directory in which to install Win-builds
.
This will start the download process for the MinGW installation manager. Wait until process is completed and select continue.
The next window will open the installation manager and you can select the packages you wish to install. On the left side, select the package you wish to install.
Next, select the following packages. make, mingw-w64, gcc, gcc-g++, make
and mark them for installation.
Finally, On the top left menu, select process.
Adding MinGW
to Path
Now that we have installed the compiler, we can use it by going into the directory we specified during the installation and executing the commands we want. However, we can add the compiler to the windows path variable to access it anywhere in the command prompt.
Click on Start and search env. Select “Edit Environment Variables”
Select Environment Variables option in the window that launches. Under System Variables, Select Path and click on Edit
Next, select New and Browse. Navigate to the installation directory and click on Ok.
Once completed, you can now execute the compiler from any location on your computer.