To finish the installation, just add C: Program Files mingw-w64 x8664-8.1.0-posix-seh-rtv6-rev0 mingw64 bin folder to the Path variable. To this end open cmd Comand Prompt and do the following. Jul 25, 2008 I installed using the process BUT this release is quite old. The gcc.gnu.org page suggests current stable release is 4.4 while the MinGW installer installs 3.4. Also this installer has g77 which is no longer a part of GNU compiler suite, its replaced by fortran95. Install MinGW-w64 MinGW-w64 comprises development tools for compiling and debugging. Download the Mingw-w64 Installer from here and follow the steps in the wizard. It is essential that the installation path does not contain any spaces. Choose an installation directory. To avoid dramas, choose a folder without spaces in the path. Something like C: MinGW-w64 x8664-8.1.0-win32-seh is best. All in all, for ordinary people, mingw-w64 is suitable for learning C language, and vs2015 is better for real work. Of course, if you are working under Linux, code:: blocks may be an option, but the biggest possibility is that you must be accustomed to using gcc to compile programs. 4、 Download and install mingw-w64.
Automated Installer
If you are new to MinGW, see the MinGW Getting Started instructions to use the automated GUI or manual CLI (Command Line Interface) installers. What follows below are instructions for a very 'manual' download, typically only attempted by more experienced users.
Manual Installation
Before you start this manual installation, read the release notes (at the bottom of the page).
- Determine which files below you need and download them.
- Extract the files into a directory such as C:MinGW
- Add C:MinGWbin; to the PATH environment variable.
You will need a program that can extract .tar.lzma files, such as 7-Zip or one that provides command-line tar and lzma tools. A basic standalone tar program that includes lzma support is available from the MinGW project and is called bsdtar.
You must add C:MinGWbin; to your user PATH environment variable manually. You can permanently add C:MinGWbin; to your PATH by following the instructions in the 'Environment Settings' section on the MinGW Getting Started page.
The resulting C:MinGW subtree is fully relocatable which means that you can have multiple installations or versions of the MinGW suite. You can potentially have installations such as:
Switching between these is merely a matter of renaming any particular directory to C:MinGW.
Files To Get
Download at least the following (or newer) packages from the MinGW Download Page. Where two or more component packages are indicated, you need both / all of them.
- binutils (bin)
- mingw-runtime (dev and dll)
- Required runtime libraries for GCC:
- mpc (dll)
- mpfr (dll)
- gmp (dll)
- pthreads (dev and dll)
- iconv (dll)
- gcc-core (bin and dev and dll)
The above are the minimum requirements for a working C Language compiler using the MinGW GCC toolchain. The support libraries (mpc, mpfr, and gmp) provide also 'dev' packages, but those are only needed if you want to link your program against those libraries. (You do need the 'dev' package for pthreads, since link commands that use -pthread need to link against this library.) Likewise, the binutils package provides a 'dev' package that includes libraries, such as libiberty.a and libbfd.a, and the corresponding headers; you may wish to install those if you want to develop programs that are linked against those libraries. If you don't find the linker scripts in the binutils 'bin' package, they might be in the 'dev' package.
You can also add one or more of the following optional compilers or tools. For each you choose to install, you need all three of the bin, the dev and the dll component packages:
- gcc-c++ (bin and dev and dll) for C++
- gcc-objc (bin and dev and dll) for Objective C
- gcc-fortran (bin and dev and dll) for Fortran 90/95
- gcc-java (not yet available) for Java
- gcc-ada (bin and dev and dll) for Ada
Note that the GCC versions of these files must match the GCC version of the gcc-core installed.
You can also add the following additional utilities:
- mingw-gdb and libexpat for debugger
- mingw32-make for make
- mingw-utils for MinGW Utilities
- msysDTK for Unix-style developer toolkit
- MSYS for Unix-style commands and shell. (See the MSYS page for installation instructions.)
You may also want the following features:
- translations of gcc, binutils, gdb, and make messages into languages other than English
- documentation for gcc-core, gcc-c++, and gcc-fortran
Getting Updates or Making Changes
Updating a single package (e.g. when there is a new version of w32api) can be done by extracting the new version to C:MinGW to overwrite the older version. This manual update also works with an initial automated install.
How to Install Cygwin
Cygwin (pronounced as SIG-win) = GNU + Cygnus + Windows. The mother site for Cygwin is www.cygwin.com.
According to the developers, 'Cygwin is a Open-source Linux-like environment for Windows. It consists of two parts:
- A DLL (
cygwin1.dll
) which acts as a Linux API emulation layer providing substantial Linux API functionality. - A collection of tools which provide Linux look and feel.'
To install Cygwin:
Step 1: Download Setup
Goto Cygwin mother site @ https://www.cygwin.com ⇒ Click 'Install Cygwin' ⇒ Download the setup program 'setup-x86_64.exe
' (64-bit Windows) or 'setup-x86.exe
' (32-bit Windows). Step 2: Run Setup to Select, Download & Install Cygwin Packages
Run 'setup-x86_64.exe
' ⇒ Install from Internet ⇒ select a directory (avoid installing in 'Program Files' because of that 'blank' character) ⇒ choose 'Local Package Directory' which saves the downloaded installation files ⇒ Direct Connection ⇒ choose a download mirror site.Select the packages that you wish to install.
Important: For programmers, you certainly need to open the 'Devel' (Development) category and select 'gcc', 'g++', 'gdb', 'make', and others, which are not part of the default selection.
Browse thru all the categories. Complete the installation process. You can always re-run 'setup' to install additional packages later.
Step 3: Setup PATH
Include the Cygwin Binary directory (bin
) in the PATH environment variable.Suppose that your Cygwin is installed in directory 'c:cygwin
'. From 'Control Panel' ⇒ (Optional) System and Security ⇒ System ⇒ Advanced System Settings ⇒ 'Advanced' tab ⇒ Environment Variables ⇒ System Variables ⇒ Select variable named 'PATH' ⇒ Edit ⇒ Add 'c:cygwinbin;
' in front of the existing PATH entry. Note that the semi-colon serves as the directory separator to separate Cygwin from the rest of directory paths.
Step 4: Verify Cygwin
Start the Cygwin Command shell (bash
or sh
) by running 'cygwin.bat
'. You shall see the command prompt '$
'. You may need to create the users' group and password files by running the following commands:Try out some Unix commands (you need to read a Unix book - there is no short-cut in learning), e.g.,
Need help? Try:
On bash shell, after setting the directory to the the 'root' (via 'cd /
'), you could find a directory called 'cygdrive
' (via 'ls
' or 'dir
'), where all the hard disks are mounted. 'cd cygdrive
' and 'ls
' lists all the hard disks, e.g., 'c
', 'd
', etc.
You may mount your C drive ('c:
') as '/c
' instead of the default '/cygdrive/c
' via this command:
You could invoke the Cygwin programs and utilities via the Windows' Command Prompt ('cmd.exe
') instead of bash shell (provided the PATH is set properly), e.g.,
How to install MinGW
[To Check] Is MinGW obsoleted by MinGW-W64, which supports both 32-bit and 64-bit Windows?
MinGW (short for 'Minimalist GNU for Windows'), is a minimalist (i.e., small but fewer features compared with cygwin) development environment for native Microsoft Windows applications, in particular:
- A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;
- GNU Binutils for Windows (assembler, linker, archive manager).
- MSYS (short for 'Minimal SYStem'), is a bash Shell command line interpreter.
To install MinGW:
- Goto MinGW mother site at http://www.mingw.org/ ⇒ Downloads ⇒ Installer ⇒ click on '
mingw-get-inst
' link to download the installer. - Run the downloaded installer.
- Set the installation directory. (Try to use a directory name without spaces, e.g., '
d:myprojectmingw
'. Try not to install under 'Program Files
' or 'Desktop
'.) - In MinGW Installation Manager, select 'Installation' ⇒ 'Update Catalogue' ⇒ Select all packages in 'Basic Setup' ⇒ continue.
- Set the installation directory. (Try to use a directory name without spaces, e.g., '
- Setup environment variable PATH to include '
<MINGW_HOME>/bin
' where<MINGW_HOME>
is the MinGW installed directory that you have chosen in the previous step. - Verify the GCC installation by listing the version of
gcc,
g++
andgdb
:
How to install MinGW-w64
MinGW-w64 is a fork of MinGW to support 64-bit Windows (as well as the 32-bit windows). The mother site is http://mingw-w64.org/doku.php.
You can install MinGW-W64 under 'Cygwin' by selecting these packages (under 'Devel' category):
Mingw W64 Sourceforge
mingw64-x86_64-gcc-core
: 64-bit C compiler for native 64-bit Windows. The executable is 'x86_64-w64-mingw32-gcc
'.mingw64-x86_64-gcc-g++
: 64-bit C++ compiler for native 64-bit Windows. The executable is 'x86_64-w64-mingw32-g++
'.mingw64-i686-gcc-core
: 64-bit C compiler for native 32-bit Windows. The executable is 'i686-w64-mingw32-gcc
'.mingw64-i686-gcc-g++
: 64-bit C++ compiler for native 32-bit Windows. The executable is 'i686-w64-mingw32-g++
'.
To check the versions:
You can also install MinGW-W64 stand-alone by downloading and run the installer.
Writing C/C++ Programs using GCC in Cygwin or MinGW (under Windows)
Read 'GCC and Make'.
Mingw W64 Dgn
REFERENCES & RESOURCES
Installing Mingw-w64 In Kali
- Cygwin Mother Site @ www.cygwin.com.
- MinGW mother site @ www.mingw.org.