Book Image

Instant MinGW Starter

By : Ilya Shpigor
Book Image

Instant MinGW Starter

By: Ilya Shpigor

Overview of this book

If you need stable, dynamically developed, and easy-to-configure instrumentation for application development, look no further than MinGW. It supplies all the dynamic tools you need to enable you to develop Microsoft Windows applications, while allowing for easy integration with the software that you already use. This book will give you the expert guidance you will need to start developing applications with Instant MinGW. As well as help you to become an experienced user of MinGW, the book will also detail some of the more common pitfalls that beginners face when first using the software, and more importantly, how to avoid them yourself. This book will help  you through the installation process, and help introduce you to compilation, debugging, and profiling with MinGW. It will guide you in importing existing projects developed with Visual C++ Integrated Development Environment to MinGW, and show you how to start using it to develop your current projects with minimal effort.This book will also introduce you to developing applications with several well-known, open source, GUI libraries and the MinGW software.With Instant MinGW Starter, you will gain a reliable, comprehensive, and supremely beneficial introduction to the MinGW software, and quickly learn how to use it for new, and old, projects.  
Table of Contents (8 chapters)

Installation


There are several ways to install MinGW software on your computer. For example, you can compile whole MinGW software by yourself, or you can just install MinGW software distribution with a few clicks. The following steps are the simplest and quickest guide to install MinGW software.

Step 1 – What do I need?

You need the following configurations on your computer to install MinGW software according to this guide:

  • Disk space of 500 MB

  • An operating system of any version of Microsoft Windows since Windows XP or newer

  • Internet connection

Step 2 – Downloading MinGW

Download a self-extracting archive with the latest version of the MinGW software distribution from the following web page:

http://nuwen.net/mingw.html

You will find two types of distribution here: one with Git and one without Git. Git is an open source distributed revision control system. I suggest you install the version with Git because it contains Bash command shell. This is a comfortable alternative for the standard Windows Command Prompt. For example, the Bash shell provides the autocomplete function that will complete the typed commands and pathnames by pressing the Tab key. Also the command history is available by pressing up and down arrows.

Step 3 – Extracting and configuring

Run the self-extracting archive. Specify the target directory and click on the Extract button.

Suppose that you choose C:\ as the target directory. The archive will be extracted to C:\MinGW. I strongly recommend you not to install MinGW software in C:\Program Files. There are problems with paths containing spaces.

Run the set_distro_paths.bat script in C:\MinGW after the archieve extraction. It will add the MinGW software directory to the PATH system variable for integration with the Windows Command Prompt and Bash shell. This script does not work properly on Windows Vista and Windows 7. Check the MinGW directory existence in the PATH variable after executing it.

What do you have to get?

Congratulations! You have got the linker, C, and C++ compilers on your computer with header files and libraries for Windows API. Boost, GLEW, SDL, PCRE, Free Type, Vorbis, and many more libraries have been installed too. Moreover, there is profiler, Bash shell, Git, and other utilities.

There are several other ways to install MinGW software. One of them may be more suitable for your goals.

Alternative ways to install MinGW

The installation process described earlier refers to the unofficial distribution of the MinGW software with additional libraries and utilities. It may seem doubtful for users accustomed to proprietary software, but this is common practice for open source users. The third-party distributions are more usable and complete than official ones in some cases. This is achieved by integrating several relative open source products into one distribution. GNU Linux distribution is a typical sample of this practice.

You can download and install the official distribution of MinGW software from the following developers' website:

http://www.mingw.org

I recommend you use the mingw-get installer application with a text-based interface. You can get a list of all the available packages by executing the following command:

$ mingw-get list

Execute the following command to install the necessary packages (for example, GCC, G++, GDB):

$ mingw-get install gcc g++ gdb

A more detailed instruction manual is available at the official MinGW website. You can simply install extensions for MinGW software using the mingw-get application.

The 64-bit MinGW software version is available from the MinGW-w64 fork. Fork is an alternative branch of mainstream software development. The goal of any fork is to achieve specific software features. MinGW-w64 is a completely different software package than MinGW with its own staff of developers. However, the basic principles of MinGW and MinGW-w64 are the same. All knowledge gained in this book you can apply to MinGW-w64 software. The following website is for the MinGW-w64 project:

http://mingw-w64.sourceforge.net

You can download the archive with MinGW software from here and unpack them. After unpacking you will get a ready-to-use MinGW software.

The following is the website of a MinGW-w64 software's unofficial distribution:

http://tdm-gcc.tdragon.net

This distribution provides a more flexible configuration of the installable components than the official one. The installation will be performed through the standard Windows Installation Wizard application.

MinGW software is supplied with some open source IDE. For example, such integrated product is available on Code::Blocks, official website http://www.codeblocks.org.