Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (2024)

Improve

MinGW is a native C/C++ compiler(GCC) which have free distributable import libraries and header files for building native Windows applications. In this tutorial, we are going to install MinGW for C/C++. These are a few steps that we have to perform to successfully install MinGW on our device.

How to Install the MinGW Tools for C/C++?

Step 1: Go to the MinGW website and click on Download. It will start downloading in 5 seconds.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (1)

Step 2: Double click and open the exe MinGW file and click install. It will automatically start downloading all the setups for the MinGW.
Step 3: After all of the setup click Continue. Now the MinGW installation manager will pop up.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (2)

Step 4: In the installation manager right click on every option and then click Mark for Installation.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (3)

Step 5: In the Installation, option-click Apply changes. And then select Apply. It will start downloading all the files. It will take 5-6 minutes. After finishing click on Close.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (4)

How to Change Environment Variables for MinGW

After successful installation of MinGW, next step is to change the environment location for MinGW.

Step 1: Go to the C drive on your device and search for the MinGW folder. And in the MinGW folder go to the bin folder and copy its path.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (5)

Step 2: Go to the control panel then go to System then Advanced system settings and then Environment variables.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (6)

Step 3: In the system variables search for path and then select Edit. Now add a new path to it by clicking New. Now paste the path and click ok.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (7)

This marks the complete installation of MinGW in the system.

Another method to change Environment Variable for MinGw.

Step 1: Go to the C drive on your device and search for the MinGW folder. And in the MinGW folder go to the bin folder and copy its path.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (8)

Step 2: Now go to this pc and right click there and click on show more properties and click on properties pointed by the arrow.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (9)

Step 3: Now click on Advanced system setting.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (10)

Step 4: Now click on environmental variables.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (11)

Step 5: Now in system variables click on path and click on edit button.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (12)

Step 6: Now click on new button and paste the copied path there as shown in photo.

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (13)

Now click on “ok” button of step 6, 5 and 4. and then close all the windows and restart your pc.

This marks the complete installation of MinGW in the system.


Last Updated : 06 Feb, 2023

Like Article

Save Article

Share your thoughts in the comments

Please Login to comment...

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks (2024)

FAQs

Installing MinGW Tools for C/C++ and Changing Environment Variable - GeeksforGeeks? ›

Step 1: Go to the C drive on your device and search for the MinGW folder. And in the MinGW folder go to the bin folder and copy its path. Step 2: Go to the control panel then go to System then Advanced system settings and then Environment variables. Step 3: In the system variables search for path and then select Edit.

How to add C :\ mingw64 to environment variables in Windows 10? ›

In the System window, click Advanced System Settings → Advanced (tab) → Environment Variables. For Windows 10, a quick access is to enter "Edit the system environment variables" in the Start Search of Windows and click the button "Environment Variables".

Does MinGW support C and C++? ›

The MinGW compiler is a well known and widely used software for installing GCC and G++ compilers for the C and C++ programming languages.

How to install MinGW 64? ›

Installing the MinGW-W64 C++ Compiler on Windows
  1. Unzip the project file. Navigate to your downloads folder, unzip the installing_mingw_64-master. ...
  2. Unzip the source file. ...
  3. Copy source files. ...
  4. Paste source files. ...
  5. Confirm. ...
  6. You need to set your PATH so windows can find the compiler.

How do I know if MinGW is installed? ›

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.

How to set environment variable in Windows C++? ›

Set Path of MinGW in Windows system environment variables
  1. Copy the path of the MinGW's bin folder.
  2. Select the Path variable and click the Edit which is under User Variable.
  3. Click the New button and add the path C:\MinGW\bin and finally click the Ok button.

Is it OK to mix C and C++? ›

If the C++ compiler provides its own versions of the C headers, the versions of those headers used by the C compiler must be compatible. Oracle Developer Studio C and C++ compilers use compatible headers, and use the same C runtime library. They are fully compatible.

What is the difference between MinGW and GCC compiler? ›

GCC stands for GNU Compiler Collection — on open source collection of compilers for various languages based on a common core compiler and linker. MinGW stands for Minimal GNU for Windows. This is a copy GCC plus other common utilities and libraries used in compiling and linking C or C++ code using the GNU tools.

Is it necessary to install MinGW for VS code? ›

C and C++ have compiled languages. So we need to install the compilers to run the code. A compiler is a software used to translate your computer-written code into machine code. To run C and C++ we need to install the MinGW compiler.

What compiler does MinGW use? ›

MinGW is a compiler system based on the GNU GCC and Binutils projects that compiles and links code to be run on Win32 (Windows) systems.

What is the latest version of MinGW? ›

The latest version from the 11.x series is 11.0.0. The latest version from the 10.x series is 10.0.0. The latest version from the 9.x series is 9.0.0. The latest version from the 8.x series is 8.0.2.

Does MinGW support 64-bit? ›

However, MinGW only supports building 32-bit applications on Windows. MinGW-w64, on the other hand, is a fork of the original MinGW project that supports building both 32-bit and 64-bit applications on Windows. It includes a 64-bit port of the GCC compiler, as well as other development tools and libraries.

Does MinGW come with GCC? ›

MinGW includes a port of the GNU Compiler Collection (GCC), GNU Binutils for Windows (assembler, linker, archive manager), a set of freely distributable Windows specific header files and static import libraries which enable the use of the Windows API, a Windows native build of the GNU Project's GNU Debugger, and ...

What is the difference between MinGW and mingw64? ›

MinGW-w64 is a improved version which supports both 32bit and 64bit, and some more of the WinAPI (still not all, because thats much work, but more than MinGW). MinGW-w64 only provides their source code, but no binaries to "just use" the compiler.

Does MinGW work on Windows? ›

Mingw-w64 community triplets

They don't depend on Visual Studio and can be used natively on Windows as well as for cross-compiling on other operating systems. There are two variants of each triplet, selecting between static and dynamic linking. The actual tools (g++ etc.)

How to add gcc to path Windows 10? ›

PATH
  1. To set the path to GCC Compiler.
  2. Open Start and type environment variables.
  3. Click Advanced System Settings.
  4. Click Environment Variables.
  5. In the System variables section add a new entry to PATH / Path .
  6. Add the following two lines.
  7. C:\msys64\mingw64\bin and C:\msys64\ming32\bin.

How to add path to environment variable in Windows 10 command line? ›

Edit %PATH% Variable in Win 10
  1. Click on Start Button and type cmd in the search box. ...
  2. To add file or directory path to your User %PATH% environment variable type the command `pathman /au` followed by the path to the directory or file, such as: `pathman /au c:\Programs\Python35`
Jan 13, 2020

How do I get to environment variables in Windows 10? ›

Saving environment variables with the System Control Panel
  1. Open the System Control Panel.
  2. Select System.
  3. Select Advanced System Settings.
  4. Go to the Advanced tab.
  5. Select Environment Variables....
  6. Make your changes.
Feb 5, 2024

How to add Python installation to PATH environment variable in Windows 10? ›

How to Add Python to PATH on Windows
  1. Step 1: Find Python Installation Directory. Before modifying the PATH variable, find the Python installation directory. ...
  2. Step 2: Locate PATH Variable Options. ...
  3. Step 3: Add Python Directory to PATH.
Dec 28, 2023

Top Articles
Latest Posts
Article information

Author: Madonna Wisozk

Last Updated:

Views: 5882

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Madonna Wisozk

Birthday: 2001-02-23

Address: 656 Gerhold Summit, Sidneyberg, FL 78179-2512

Phone: +6742282696652

Job: Customer Banking Liaison

Hobby: Flower arranging, Yo-yoing, Tai chi, Rowing, Macrame, Urban exploration, Knife making

Introduction: My name is Madonna Wisozk, I am a attractive, healthy, thoughtful, faithful, open, vivacious, zany person who loves writing and wants to share my knowledge and understanding with you.