TDM Logo
A GCC / MinGW / MinGW-w64 compiler suite for 32- and 64-bit Windows

TDM-GCC

2011-09-23 New releases: 4.6.1-tdm-1 and 4.6.1-tdm64-1

Getting Started

Table of Contents:
  1. Which edition should I choose?
  2. Installation
  3. Compiling
  4. Getting help

Which edition should I choose?

TDM-GCC currently comes in two different editions: the standard MinGW-based "TDM" edition, and the MingW-w64-based "TDM64" edition. Both editions are based on the same set of tools and provide similar or identical functions. You may install both editions on the same PC, though not in the same directory.

MinGW
  • only supports creating 32-bit programs.
  • is more mature and has a more stable codebase.
  • is already supported by a wide variety of open-source software.
MinGW-w64
  • supports creating 32-bit or 64-bit programs.
  • is a younger fork of MinGW.
  • undergoes heavier day-to-day development.
  • has a smaller (but growing) list of open-source software that supports it.
The MinGW project also supplies "MSYS", a minimal POSIX-like command line environment that is designed to facilitate porting open-source software to MS-Windows. MSYS is not distributed as a part of TDM-GCC, but it works well with either edition of TDM-GCC.

SJLJ or DW2?

The MinGW/TDM edition of TDM-GCC additionally offers two different methods of exception handling for your programs: SJLJ (setjmp/longjmp) and DW2 (Dwarf-2). As a general rule, you should choose the default SJLJ packages, unless you know you need faster exception handling and can guarantee you'll never need to unwind through non-DW2-compiled stack frames (such as a Windows callback). If you choose the DW2 packages, consider removing the "-dw2" suffix from the program names. See "SJLJ unwinding vs. DW2 unwinding" in the README for further notes on this topic.

The MinGW-w64/TDM64 edition currently only supports SJLJ unwinding.

Installation

The easiest way to install TDM-GCC is with the provided Windows installers.
There are "bundle" installers for each edition that contain a standard toolchain consisting of the C and C++ compilers and associated tools, the runtime libraries and headers, GNU make, and GDB (the GNU source-level debugger). There is also an "on-demand" installer that contains no packages, but will automatically download and install the specific set of packages that you choose. Finally, for those who need or prefer a manual installation, zip and tar.lzma archives of each individual package are also available.

Do not install TDM-GCC to "C:\MinGW"!
Previously, the recommended path to install MinGW at was "C:\MinGW". This is no longer the case -- because other versions of GCC search that path for headers and libraries even if they are not installed there. TDM-GCC has been patched to fix this problem, but most other MinGW/GCC distributions have not. This means that if you have more another installation of MinGW or MinGW-w64, it will always search for headers and libraries in "C:\MinGW", and you'll probably end up using the wrong headers and libraries inadvertently. Therefore, it's now recommended that you use a different path for your installation.

Compiling

As with most other compilers, GCC is a command-line tool that uses named options to control its operation. An introduction to GCC command-line compilation is beyond the scope of this discussion, but there are a few MinGW and MinGW-w64 specifics that should be mentioned.

In the MinGW-w64/TDM64 edition, use "-m32" and "-m64" to control whether 32-bit or 64-bit binaries are generated.
By default (if neither -m32 nor -m64 is specified), this edition will generate 64-bit binaries. In a 64-bit binary, all pointer math is 64-bit by default, and the built-in "size_t" and "ptrdiff_t" types are 64 bits in size (some other types are larger also). Additionally, the following preprocessor definitions will be in effect:
  • #define _WIN64 1 (also WIN64, __WIN64, and __WIN64__)
  • #define __MINGW64__ 1
  • #define __x86_64 1 (also __x86_64__)
  • #define __amd64 1 (also __amd64__)
Be sure to use "-m32" or "-m64" at both the compile stage and the link stage.

Getting help

Do NOT seek help for TDM-GCC-specific issues from the MinGW project.
Because the MinGW project provides its own official binary packages, you should only seek help from the MinGW forums for those packages. If you have a problem using the MinGW edition of TDM-GCC, make sure it also applies to the official MinGW packages before posting it to the MinGW project.

DO seek help for MinGW-w64/TDM64 issues from the MinGW-w64 project.
The administrators of the MinGW-w64 project have expressed their approval of the TDM64 edition of TDM-GCC as a binary distribution of MinGW-w64. If you have an issue relating to MinGW-w64 or the x86_64-w64-mingw32 target of GCC, you may request help from any of MinGW-w64's support venues including SourceForge PR trackers, a mailing list, and an IRC channel (see <http://mingw-w64.sf.net/> for further information).

Use TDM-GCC's SourceForge trackers as a last resort.
Because TDM-GCC is primarily a binary distribution of sources provided by other projects, with only miminal changes, the majority of issues you encounter will probably be present upstream as well. Because of this, and because of a lack of manpower to appropriately support TDM-GCC on its own, please only post issues that specifically relate to TDM-GCC, but not its upstream projects (GCC, binutils, MinGW, and MinGW-w64) on the TDM-GCC SourceForge trackers. If you have encountered an issue with the MinGW edition of TDM-GCC, you can use the TDM-GCC installer to create a MinGW installation with the MinGW project's own official packages, and see whether or not the issue is also present there.
The TDM "dragon" logo displayed on this page may not be displayed elsewhere in any manner unless expressly permitted by the author ("John E." / tdragon (at symbol) tdragon (period) net), or unless such display must be permitted due to governing fair-use laws. All other portions of this page, excluding the logo but including text, layout, and other graphical elements, are released into the public domain and may be freely reused without restriction.