banner



How To Install C++ Compiler In Windows 10

How to Install C and C++ Compilers on Windows

If you desire to run C or C++ programs in your Windows operating system, and then you need to accept the right compilers.

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

But many devs face up difficulties when installing the compiler, so I am going to testify you all the steps to exercise so in this article with screenshots to help you get it done.

I will be using Windows 11, but the same process is applicable for all other Windows operating systems unless you lot are using Windows XP (You need to change some steps in Windows XP).

Install MSYS2

Firstly we demand to download an executable file from MSYS2. Go to the official website of MSYS2: https://www.msys2.org/. The website looks like below every bit of today.

Screenshot--8-

Scroll downward a fiddling chip until y'all find the download push button for the executable file.

Screenshot--9-

Simply click on the installer push button and relieve the installer file in whatever place you want.

Screenshot--10--1

Finish downloading the executable file. Information technology should non take much time depending on your internet speed.

Screenshot--11-

Subsequently downloading the file, we will become this executable file.

Screenshot--12-

Double click on the executable file. Then click Next.

Screenshot--13-

Keep the name as it is, and click Next.

Screenshot--14--1

Keep all this as it is, and click Next.

Screenshot--15-

Give information technology some time to cease the installation process.

Screenshot--16-

If you lot proceed the checkmark, then the MSYS2 terminal volition open once you click Finish.

Screenshot--17-

I prefer to do it this way, but if you want to practice the remaining tasks later, and then you need to open the terminal by yourself from the start menu.

In that case, you have to click the offset push button > Search for MSYS2 and click on the terminal like in the following picture show:

Screenshot--26-

Permit me presume that we have opened the MSYS2 MSYS terminal successfully.

Apply the control pacman -Syu to update the package database and the base packages.

Screenshot--19-

Type Y and press the enter fundamental if you get this blazon of installation prompt.

Screenshot--20-
Screenshot--21-
Screenshot--22-

Type Y and press the enter central.

Screenshot--23-
Screenshot--24-

The final will be closed. We have to open the terminal manually and update the rest of the packages.

Click the get-go button.

Screenshot--25-

Search the folder named MSYS2 64bit. Click on the folder to expand and get the concluding. Open the concluding past clicking MSYS2 MSYS.

Screenshot--26--1

Update the rest of the packages past applying the control, pacman -Su.

Screenshot--27-

If you lot become whatever installation prompt, then yous need to type Y or y and press the enter key.

Screenshot--28-
Screenshot--29-

Wait a picayune to finish the installation.

Screenshot--30-
Screenshot--31-

Close the window subsequently finishing the installation.

Install the K++ and Thou++ Compilers

Click the start push button. Find the MSYS2 64bit folder. Click on that folder to expand it.

Screenshot--32-

If you are using a 64 bit operating arrangement similar I am, and then we demand to use the MSYS2 MinGW x64 concluding. Click on the last to open that.

Screenshot--33-

⚠️ But, if you are using a 32 bit operating system, then you have to use the MSYS2 MinGW x86 last. And then, y'all need to open that terminal.

Screenshot--34-

As I am using a 64 bit operating system, I have opened the terminal for 64 bit. Apply the control pacman -S mingw-w64-x86_64-gcc to install the compilers.

⚠️ If you are using a 32 bit operating system, then you have to apply the control pacman -S mingw-w64-i686-gcc in your 32 flake terminal.

Screenshot--35-

Expect for a little while.

Screenshot--36-

Blazon Y or y and press the enter fundamental if you get the installation prompts.

Screenshot--37-
Screenshot--38-

Give it some time to end the installation process.

Screenshot--39-
Screenshot--39--1

You've at present finished installing the compilers.

How to Install the Debugger

If you are using a 64 bit operating organization similar I am, then yous have to apply the control pacman -South mingw-w64-x86_64-gdb.

⚠️ If you lot are using a 32 bit operating system, so yous have to apply the command pacman -S mingw-w64-i686-gdb in your 32 bit terminal.

Screenshot--41-

If you get any installation prompt, and so simply blazon Y or y and printing the enter key.

Screenshot--42-
Screenshot--38--1

Give it some time to end the installation.

Screenshot--44-
Screenshot--45-

Y'all can shut the terminal.

How to Add the Directory to the Path of the Surround Variables

Open the file explorer.

Screenshot--46-

I am assuming that you have installed the MSYS into the default directory like I take. If you used custom directories, then you need to get to the directory where y'all installed it.

Screenshot--47-

If you are using a 64 bit operating organisation like I am, then go to the mingw64 folder.

⚠️ If y'all are using a 32 flake operating arrangement, so go to the mingw32 folder.

Screenshot--48-

We have to go to the binary folder now. Go to the bin folder.

Screenshot--49-

⚠️ If yous are using a 32 scrap operating system, then you have to go into your mingw32 folder > bin folder.

Copy the directory.

Screenshot--51-

⚠️ If you are using a 32 chip operating organization, and you as well installed the MSYS2 in the default directory, then your directory should exist like the following:

                C:\msys64\mingw32\bin              

Open up the Avant-garde System Settings. You can do that in many ways. A simple mode is to simply click the starting time push and search for it like the below screenshot.

Screenshot--52-

Click Environment Variables from the Advanced tab.

Screenshot--54-

Click on Path and select that. And then click Edit.

Screenshot--57-

A window will announced as below:

Screenshot--58-

Click New.

Screenshot--59-

A bare box volition appear.

Screenshot--60-

Paste the directory here.

Screenshot--61-
Screenshot--62-

Click OK.

Screenshot--63-

Click OK.

Screenshot--65-

Click OK.

Screenshot--66-

If yous want to get all the steps in a video, then you can sentry this video also.

Check the Install

At present it is time to check whether we have successfully installed all of the in a higher place or not.

Open the terminal / PowerShell / CMD and apply the commands serially:

For checking the GCC version:

                gcc --version              
Screenshot--68-

For checking the G++ version:

                g++ --version              
Screenshot--69-

For checking the GDB version:

                gdb --version              
Screenshot--70-

Conclusion

I promise this commodity helps you install your compilers on the Windows operating system for C and C++ programs.

Cheers a lot for reading the unabridged article. If you have any suggestions then you may get in affect with me through my twitter or LinkedIn accounts.

If yous are into open source, then you tin can too follow me on GitHub as I am very active in contributing to open source projects.

If you similar programming-related tutorials, and so I have two YouTube channels. In one aqueduct, I publish Bengali content regularly, whereas I publish English content regularly in my other channel.

Have a wonderful day!



Larn to code for free. freeCodeCamp'south open up source curriculum has helped more than than 40,000 people go jobs equally developers. Get started

Source: https://www.freecodecamp.org/news/how-to-install-c-and-cpp-compiler-on-windows/

Posted by: kimvithopipatch.blogspot.com

0 Response to "How To Install C++ Compiler In Windows 10"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel