This tutorial is intended for developers who want to start developing in C on Windows, without having to use a heavy software like VisualStudio. And having a Linux like shell of course.
Download MinGW for Windows at:
Execute the MinGW installer
in admin mode
Follow the installer steps
Then close the window
A new winows appears : the installer
select packages to install :
- base (c compiler)
- g++ (c++ compiler)
- msys (NIX shell)
Then click on Installation menu, update catalogue
A new window appears with some gibberish text. Click on Review
Click on Apply
Then wait for the end of the download (30 secondes)
After, close the installer
Explorer your C: harddrive. A new MinGW folder appears
Click on C:\MinGW\msys\1.0\msys.bat
A new NIX shell appears.
Create a .profile file inside (on Windows it’s not possible to create a file starting with “.”, so copy a file from my github or create it with touch command with the NIX shell)
Close it. It’s just for the creation of the default user home folder.
A new home folder appears at C:\MinGW\msys\1.0\home\
Open it. It contains your home folder (in my case: C:\MinGW\msys\1.0\home\Damien)
Open .profile with your text editor and add this :
# Cd to my windows home:
Save it. And start msys.bat again
At NIX shell, type the ls command.
The result is the content of your Windows user folder, instead of the NIX C:\MinGW\msys\1.0\home***
Close this windows.
Then create a shortcut of msys.bat to your desktop or set it in your Windows path env.
Your environnement is ready!
Create a c source code file in your user folder with your text editor
A new NIX shell appears. Type the compile command gcc on your new source file.
Execute the generated executable with : a NIX command :
or a Windows click on the .exe
or a windows command line
MinGW is a simple and friendly tool for those who seek to program on a Linux like shell on Windows.
…BUT the MinGW documentation is very harsh with newbies, installer steps are very strange for a Windows user and the downloading package part required a lot of time (not easy in offline mode).
It’s not a turnkey solution, but it does the job.