Installing compiler (GCC) for host (WINDOWS)
How to install gcc in windows?
First, download the MinGW 64-bit or 32-bit version. So, type MinGW 64 bit in Google and go to this link mingw-w64.org .
- First, go to downloads.
- And Click on MinGW-w64 builds option.
- Click on Mingw-builds, installation:sourceforge. So, click over this.
- And wait for some time, and you must download the Mingw-w64-install.exe file. These steps are shown in Figure 2.
And also, you must install MSYS. For that, go for this option Installation: GitHub. So, click over this link, and it takes you to msys2.org.
And here, you can see Download the installer, as shown in Figure 4. Click over that option.
Let’s install the MinGW toolchain—double-click over that application. (shown in Figure 5)
Now click Next.
Here, if you are installing a 32-bit version, you select i686, or if your machine is the 64-bit version, then you can go for x86_64. So, it’s better to install the 64-bit version. So these options please don’t change (Figure 7). And now, let’s click Next.
The MinGw application will be installed here, as shown in Figure 8. Please note this path because we will be referring to this path later. Now click Next.
It will take some time to install all the files. Now let’s click Next to continue the installation.
Now the installation is over. Click Finish.
And we have also downloaded the MSYS2 installer. We have to install this. So, double click over that, and click Next, as shown in Figure 11.
You select the installation folder and click Next.
Click Next, and you must complete this installation.
Now the installation is completed. You need not run this, so uncheck this Run MSYS2 64bit now option. Then, click on Finish.
After the installation, we have to verify by running some MinGW and MSYS commands.
For that, open the command prompt. And type’ gcc.’ You can see that it says ‘gcc’ is not recognized as an internal or external command. And you also type ‘rm’ here, it says the remove command is not recognized.
Actually, we have already installed the MinGW toolchain and the MSYS toolchain. Still these commands are not recognized. So, to get rid of this problem, we have to do path setting.
For that, Go to Properties and select Advanced system settings. Here, open Environment variables. (see Figure 16)
Here you have to modify some user variables. We have to edit this user variable, that is, path. Select the path option and click on Edit.
And select New to add a new path.
The first path is the path where the MinGW tools are present, and another is where the MSYS files are present.
How do you get that path?
Go to the Installation folder of MinGW. So, that is actually under C → program files → mingw-w64 → open that. Go under x84_64-8.1.0-posix-seh-rt_v6-rev0 → mingw64 → open the bin, and there are some tools. And select the path and copy it, as shown in Figure 19.
And you paste that path into the environment variable, shown in Figure 18.
For the MSYS2 path, go to the C directory – msys64 – go under usr – bin and copy the path and come over to the environment variables to paste that path.
You have added the MinGW and MSYS path and then click OK, OK, OK.
Now reopen the command prompt and Type ‘gcc.’ It should be recognized. And the remove command also should be recognized, as you can see in Figure 21.
These two commands we use to compile and clean the project. That’s a procedure to install a GNU tool for windows.
In the following article, I will cover for Linux and Mac.
FastBit Embedded Brain Academy Courses
Click here: https://fastbitlab.com/course1