Hey There!, Welcome Back to Think & Free. In the previous lesson, I showed up to you, how to get download and install GNU GCC Compiler on your Windows System using MinGW. This is part two of How to Install GCC On Windows. This lesson, I will show you how to get Configure Correctly MinGW in Windows System.
Once you correctly installed GNU GCC Compiler using MinGW on your Windows system. Then you need to Create a Path variable for, getting Access to GCC. Now I’m going to show you how to Create Path Variable and how to Configure MinGW Correctly. Let’s see how it works.
What is Path Variables?
C:\WINDOWS\system32 is a first path variable in Windows systems. path variable defines it contains some executable paths were it has been located or where it has been installed path in the Windows System. If some program configured in PATH Variable it can access anywhere by Using Command Prompt. That is about PATH Variables. Now we need to create a new path variable for our MinGW installation path before starting working with MinGW.
Create Path Variable & Configure MinGW
First Open up Control panel window by Start and Search “Control Panel“. And go to System and Security. Now we can see all of System and Security Setting in here. Now we need to select System.
Another way is you can Open up System Configuration Window by simply Go to the This PC and Right-click the Icon. Now select Properties. In the left side pane on System Configuration window will provide some Administrator options. Now we need to go to the Advanced system settings in there.
Once you tap the Advanced system settings option. You can see another little window will prompt. That is a “System Properties” window. In this window, go to the Environment Variables Under the Advanced Options.
It will prompt another window, Called “Environment Variables“. Now we are going to create a Path Environment Variable for our MinGW Installation Directory. In the Top of “Environment variables” Window, you can see User variable for <USERNAME>, That means these variables only allowed to the Current user. If you install MinGW Only for you, you can create PATH Variable in here.
I’m choosing for All, In that cause, I’m going to create System Variable. These types of Variables allowed all users in that system. Let’s see how to do it.
Creating PATH Variable
First Go to PATH in System Variables, and select it. Hit the Edit button at the bottom. Now You can see the “Edit Environment Variable” window will appear.
First, copy the full path of the MinGW installation directory. In that location, we can see a directory called “bin“. All binaries will be located in this directory. Ok now Select “New” Option in Left side top on the “Edit Environment Variable” window.
It will allow us to add a new PATH Variable. Now Paste, That you copied, The full path of, the bin directory. It located in the MinGW installation directory.
In my System,
C:\MinGW\bin. I’m using the default MinGW installation path. if you change it on Installation process you must give it correctly here.
Now hit the OK button. Our Path Variable setup process has been completed!. Now Hit the OK button in all windows and Close them. Let’s check, our Path variable is work correctly?.
Open up new command prompt window and type
gcc --version. it will prompt GCC version information. if you got some message like this. That means The MinGW Configuration setup was successful. Or not, check again and create a correct path for bin directory located in the MinGW installation directory.
I hope you guys enjoy this. if you have questions with this leave a comment.