Use GNU on Windows with MinGW (2024)

If you're a hacker running Windows, you don't need a proprietary application to compile code. With the Minimalist GNU for Windows (MinGW) project, you can download and install the GNU Compiler Collection (GCC) along with several other essential GNU components to enable GNU Autotools on your Windows computer.

InstallMinGW

The easiest way to install MinGW is through mingw-get, a graphical user interface(GUI) application that helps you select which components to install and keep them up to date. To run it, download mingw-get-setup.exe from the project's host. Install it as you would any other EXE file by clicking through the installation wizard to completion.

InstallGCC on Windows

So far, you've only installed an installer—or more accurately, a dedicated package manager called mingw-get. Launch mingw-get to select which MinGW project applications you want to install on your computer.

First, select mingw-get from your application menu to launch it.

To install GCC, click the GCC and G++ package to mark GNU C and C++ compiler for installation. To complete the process, select Apply Changes from the Installation menu in the top-left corner of the mingw-get window.

Once GCC is installed, you can run it from PowerShell using its full path:

PS> C:\MinGW\bin\gcc.exe --versiongcc.exe (MinGW.org GCC Build-x) x.y.zCopyright (C) 2019 Free Software Foundation, Inc.

RunBash on Windows

While it calls itself "minimalist," MinGW also provides an optional Bourne shell command-line interpreter called MSYS (which stands for Minimal System). It's an alternative to Microsoft's cmd.exe and PowerShell, and it defaults to Bash. Aside from being one of the (justifiably) most popular shells, Bash is useful when porting open source applications to the Windows platform because many open source projects assume a POSIX environment.

You can install MSYS from the mingw-get GUI or from within PowerShell:

PS> mingw-get install msys

To try out Bash, launch it using its full path:

PS> C:\MinGW\msys/1.0/bin/bash.exebash.exe-$ echo $0"C:\MinGW\msys/1.0/bin/bash.exe"

Setthe path on Windows

Programming and development

You probably don't want to have to type the full path for every command you want to use. Add the directory containing your new GNU executables to your path in Windows. There are two root directories of executables to add: one for MinGW (including GCC and its related toolchain) and another for MSYS (including Bash and many common tools from the GNU and BSD projects).

To modify your environment in Windows, click on the application menu and type env.

A Preferences window will open; click the Environment variables button located near the bottom of the window.

In the Environment variables window, double-click the Path selection from the bottom panel.

In the Edit Environment variables window that appears, click the New button on the right. Create a new entry reading C:\MinCW\msys\1.0\bin and click OK. Create a second new entry the same way, this one reading C:\MinGW\bin, and click OK.

Accept these changes in each Preferences window. You can reboot your computer to ensure the new variables are detected by all applications, or just relaunch your PowerShell window.

From now on, you can call any MinGW command without specifying the full path, because the full path is in the %PATH% environment variable of your Windows system, which PowerShell inherits.

Hello world

You're all set up now, so put your new MinGW system to a small test. If you're a Vim user, launch it, and enter this obligatory "hello world" code:

#include <stdio.h>#include <iostream>using namespace std;int main() { cout << "Hello open source." << endl; return 0;}

Save the file as hello.cpp, then compile it with the C++ component of GCC:

PS> gcc hello.cpp --output hello

And, finally, run it:

PS> .\a.exeHello open source.PS>

There's much more to MinGW than what I can cover here. After all, MinGW opens a whole world of open source and potential for custom code, so take advantage of it. For a wider world of open source, you can also give Linux a try. You'll be amazed at what's possible when all limits are removed. But in the meantime, give MinGW a try and enjoy the freedom of the GNU.

Use GNU on Windows with MinGW (5)This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.

Use GNU on Windows with MinGW (2024)
Top Articles
Texas (TX) Lottery - Winning Numbers & Results
Completing The Square Calculator Mathpapa
Craglist Oc
How To Be A Reseller: Heather Hooks Is Hooked On Pickin’ - Seeking Connection: Life Is Like A Crossword Puzzle
Rainbird Wiring Diagram
Www.craigslist Augusta Ga
Sunday World Northern Ireland
Valentina Gonzalez Leaked Videos And Images - EroThots
What Was D-Day Weegy
Lqse-2Hdc-D
Dusk
Shooting Games Multiplayer Unblocked
Rosemary Beach, Panama City Beach, FL Real Estate & Homes for Sale | realtor.com®
Evil Dead Rise Showtimes Near Regal Columbiana Grande
Animal Eye Clinic Huntersville Nc
Calmspirits Clapper
Labor Gigs On Craigslist
Nj State Police Private Detective Unit
Samantha Lyne Wikipedia
Navy Female Prt Standards 30 34
Officialmilarosee
Bridge.trihealth
Welcome to GradeBook
Panic! At The Disco - Spotify Top Songs
Isaidup
Www.dunkinbaskinrunsonyou.con
Gazette Obituary Colorado Springs
Caring Hearts For Canines Aberdeen Nc
The Collective - Upscale Downtown Milwaukee Hair Salon
Dairy Queen Lobby Hours
Free Tiktok Likes Compara Smm
Planned re-opening of Interchange welcomed - but questions still remain
Willys Pickup For Sale Craigslist
King Soopers Cashiers Check
Tributes flow for Soundgarden singer Chris Cornell as cause of death revealed
Santa Cruz California Craigslist
42 Manufacturing jobs in Grayling
Imperialism Flocabulary Quiz Answers
Sams La Habra Gas Price
Cl Bellingham
Elizaveta Viktorovna Bout
2008 DODGE RAM diesel for sale - Gladstone, OR - craigslist
What Is Kik and Why Do Teenagers Love It?
Immobiliare di Felice| Appartamento | Appartamento in vendita Porto San
Doe Infohub
Myrtle Beach Craigs List
How Big Is 776 000 Acres On A Map
All Weapon Perks and Status Effects - Conan Exiles | Game...
Dicks Mear Me
Benjamin Franklin - Printer, Junto, Experiments on Electricity
Stephen Dilbeck, The First Hicks Baby: 5 Fast Facts You Need to Know
Gelato 47 Allbud
Latest Posts
Article information

Author: Arielle Torp

Last Updated:

Views: 5547

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Arielle Torp

Birthday: 1997-09-20

Address: 87313 Erdman Vista, North Dustinborough, WA 37563

Phone: +97216742823598

Job: Central Technology Officer

Hobby: Taekwondo, Macrame, Foreign language learning, Kite flying, Cooking, Skiing, Computer programming

Introduction: My name is Arielle Torp, I am a comfortable, kind, zealous, lovely, jolly, colorful, adventurous person who loves writing and wants to share my knowledge and understanding with you.