Installing GCC Compiler in Windows To Run C Program on Gitbash and Setting the PATH Variable
David Michael
Software Developer || Backend Developer || Python - Django Enthusiast || DRF - RESTful API || IT Support Specialist || Tech Advocate
GCC, or GNU Compiler Collection, is a popular open-source compiler used for developing and executing various programming languages, including C, C++, Fortran, Ada, and more. In this article, we will guide you through the process of installing GCC on a Windows operating system and setting the PATH variable.
Step 1: Download MinGW-w64
The first step in installing GCC on Windows is to download MinGW-w64, a compiler that provides support for GCC on Windows. You can download MinGW-w64 from?Here.
Step 2: Install MinGW-w64
Once the download is complete, double-click on the MinGW-w64 installer file to start the installation process. The installer will guide you through the installation process and prompt you to select the components you wish to install.
Step 3: Select Packages Required for the Compiler.
There are three packages required for the basic MinGW setup that you have to choose from the MinGW Installation Manager.
Step 4: Apply the Changes
After selecting all the required packages, go to Installation>>Apply Changes and click on Apply Changes.
Step 5: Download the Changes.
Now it is time to download all the packages you selected in the previous step. Click on Apply and proceed further to download and install them.
This process might take a while, you just be patient. After the installation of MinGW is finished. To check if it is installed or not, open Command Prompt and type g++ — version.
The MinGW compiler (GCC) is not being detected by the command prompt because the environment path variable has not been set. The environment path variable is crucial in detecting the compiler throughout the system and creates an alias name for the compiler, indicating its location. To set the environment path variable for MinGW on a Windows system, follow the steps outlined below.
Setting up Path Variable
To set up the path for the C compiler for windows, follows the below steps :
Step 1: Copy the path of the MinGW bin.
When you install the MinGW, it creates a folder named MinGW in C: Drive. To set the compiler’s path, we need the path to the bin directory of MinGW. So, first,
领英推荐
Step 2: Setting the Environment Variable
Step 3: Verify the Installation
To verify the installation of GCC on your Windows system, open the Command Prompt and type the following command:
gcc — version
If the installation was successful, you should see the version of GCC that you have installed.
Conclusion
Installing GCC on Windows and setting the PATH variable is a straightforward process. With GCC installed, you can now start developing and compiling programs in various programming languages. Remember to always double-check the PATH variable to ensure that the system can locate the GCC compiler.
<p> Never miss out on resources, opportunities to help you grow as a tech enthusiast. </p>
<a href=’#’>I regularly post them here
Find me on?GitHub
</a>
If you love such materials, please follow to see more contents.
<code on>
--
1 年Thanks a lot!
Mechanical Engineer specializing in Microfluidics
1 年How can you turn .c file into dll using gcc?
3rd Year - Electronics and Computer Science Student at University of Edinburgh
1 年Very clear and very helpful. Thank you so much for walking me through this.
Web3 | Sales Manager | Land and Properties |
1 年not able to add to the system variable as it didn't highlight the 'edit' button for use.