Code::Blocks – TDM-GCC Installation – Part 1 of 2

TDM-GCC Compiler Suite and Code::Blocks

Almost every programming language requires the installation of a compiler and an editor or IDE (Interactive Development Environment) to accompany it.  Instructions for installing the TDM-GCC compiler suite is the topic of this post.

A second post will soon follow that discusses installation of the Code::Blocks IDE.  Code::Blocks is an Open-Source, cross-platform  IDE that supports a number of programming languages and is ideally suited for both C and C++.

Why are we discussing the TDM-GCC compiler suite first?

A compiler is only interested in processing source code or program files.  Source code can be written using any plain text editor.  As such, the compiler and the editor can be wholly separate and independent entities.  You will see this demonstrated when we confirm our installation of TDM-GCC.

The setup file for the Windows installation of Code::Blocks only provides a 32-bit GNU GCC compiler where having the ability to generate both 32-bit or 64-bit is preferable.  If you choose to install the Code::Blocks IDE without a MinGW compiler, a separate installation of the compiler will be required.

The other reason for doing this now is to get comfortable working with the TDM-GCC installation and setup wizard.  Knowing how to setup TDM-GCC from scratch is not a difficult process and upgrading to newer revisions becomes a much easier process.

Note that an Interactive Development Environment or IDE simply combines the editor, compiler, and other coding tools into a seamlessly integrated working environment where they are easily accessed without ever having to leave the workspace.  An IDE can save a tremendous amount of time in the overall project development cycle and offers many features that make coding a more fluid and effective process for programmers.

Installing TDM-GCC

tdm-gcc is a compiler suite for 32-bit and 64-bit versions of GCC and is available for download from tdm-gcc.tdragon.net.  The Download page presents 3 installers:  32-bit, 64-bit, and an On-Demand installer that can be used to select which version(s) to download and install.

tdm-gcc-tdragon-net-download-page

For our purposes, we downloaded the On-Demand installer:  tdm-gcc-webdll.exe:tdm-gcc-on-demand-close-up

Double click the link and when prompted, click “Save” to save the file in your downloads directory:

tdm-gcc-whatdoyouwanttodowiththisfile

When the download is complete, DON’T click the run button unless you only want the current “single” user to have access the software.  To install for ALL users, open the download directory and right click on the tdm-gcc-webdl.exe file to “Run as Administrator”.

tdm-gcc-execute-file

You will be presented with the following TDM-GCC Setup Wizard when you run the application:

tdm-gcc-setup

As this is a new installation, click “Create” then, on the next window that appears, choose the edition you want installed:

tdm-gcc-edition-32-64

The default is the first option, MinGW/TDM (32-bit).  We chose the second option, MinGW-w64/TDM64 (32-bit and 64-bit).  Regardless of choice, the TDM-GCC Setup wizard can be used to modify your installation at any time.

tdm-gcc-64-32-bit-install

After making your selection and clicking “Next” the “License Changes” window will appear.  This is free software, however, there are licensing requirements that you should be aware of before publishing your software.  Please read the changes noted.

tdm-gcc-setup-license-agreement

Click “Next” and the Installation Directory window will appear where we select the directory where we want TDM-GCC to be installed.  The default location is in the ROOT directory as C:\TDM-GCC-64 although you can browse to select or create a different directory for the installation.

tdm-gcc-64-new-installation-directory

Accept the Installation directory default or browse for another location of your choosing and click “Next” to select the location of the download server:

tdm-gcc-download-mirror-select

The default “SourceForge” serves our purposes.  Click “Next” to choose the components or features you want installed as pictured below:

tdm-gcc-choose-components

You will notice that the check box immediately below “Components” and next to “gcc (TDM64 Current:  5.1.0-tdm64-1)” is shaded in green, meaning not all of the possible options available have been selected.  Click on the “+” to the left of the check box to expand the selection:

tdm-gcc-choose-components-gcc-expansion

You will see that only the radio button next to “TDM64 Current: 5.1.0-tdm64-1” and the check boxes next to “core” and “C++” are selected.  Other optional components include fortran, ada, objc, and openmp.

Simply clicking in the check box next to each feature will toggle the selection on or off.  When you are ready, click the Install button and get ready to take a break.  The download process will take quite some time depending on the speed of your internet connection.

tdm-gcc-installing

If the download process is interrupted, the installer will prompt you to “Retry” or “Cancel”.  We experienced several interruptions during our download and the final install was successful.

When the download is finished the Installation Complete window will appear.

tdm-gcc-installation-completed

You can click on the details button for a listing of all the installation steps taken.  When you’re ready, click “Next”.

tdm-gcc-setup-complete-installed

Click finish, read the TDM-GCC README file when it pops up (unless you unchecked the box) and get ready to confirm your installation.

tdm-gcc-readme

Congratulations! The TDM-GCC compiler is now installed and ready for business.

Confirm your Installation

To test the installation, I wrote a small program in C to ensure the compiler actually works:

/************************************
Scope: Confirm TDM-GCC Installation
Type: Command Line Application
Use: gcctest (executable)
***********************************/

#include
main()
{
printf(“gcctest.c compiled.\n”);
printf(“gcctest.exe executed.\n”);
printf(“gcctest successful!\n”);
return 0;
}

Go to the command prompt on your machine and locate the subdirectory where the “C” source file was saved.

At the command prompt (C:\…>) type “gcc–version” (without the quotes) and press the Enter key.  The version number (5.1.0 in our case) should appear on the screen.

To confirm your source file is in the current directory type “more < gcctest.c” (without the quotes) and press the Enter key.  The file’s contents should be displayed on the screen.

Now we’re ready to test that the compiler actually works.  Type “gcc gcctest.c -o gcctest” and press the Enter key.  The program should execute and display our message.

As pictured below, the current version is gcc (tdm64-1) 5.1.0 and our compiler worked successfully as demonstrated and confirmed by executing the gcctest.exe program:

tdm-gcc-confirm-setup-and-install

You have now successfully installed the TDM-GCC compiler on your computer and you’re ready to start programming in C / C++.

Getting started with C

If you are new to C and have no programming experience at all, I highly recommend buying or borrowing a copy of the book titled, “C Programming Absolute Beginner’s Guide (3rd Edition)“, by Greg Perry and Dean Miller.  Que Publishing – Copyright 2014 by Pearson Education, Inc.  337 pages.  ISBN-13:  978-0-7897-5198-0, ISBN-10:  0-7897-5198-4.

For a preview of the book or to purchase your copy visit:  C Programming Absolute Beginner’s Guide (3rd Edition)

Experienced C++ programmers:

The book titled “C++ Application Development with Code::Blocks” by Biplab Kumar Modak presents more advanced topics for developers or programmers with basic knowledge of the C++ programming language who are looking to develop cross-platform applications with Code:Blocks.

To preview or purchase your copy visit:  C++ Application Development with Code::Blocks.  Published by Packt Publishing (25-Oct-2013), 128 pages.  The book is available in both eBook and Paperback formats.

Related Articles – Resources:

GCC and Make – Compiling, Linking and Building C/C++ Applications

Related BOOKS:  GCC Compiler Collection

GCC:  Questions and Answers, George Duckett

The Definitive Guide to GCC (Definitive Guides), William von Hagen

GCC:  The Complete Reference, Arthur Griffith, 647 Pages,  Based on the print edition (ISBN 9780072224054), McGraw-Hill Education; 1st Edition.

C++11 Rocks:  GCC Edition, Alex Korban

The GNU Make Book, John Graham-Cumming

GCC 7.0 GNU Compiler Collection Internals (1/2 and 2/2) by Richard M. Stallman and Gcc Dev Community.

Using the Gnu Compiler Collection: A Gnu Manual for Gcc Version 4.3.3 Paperback – Mar 20 2009 by Richard M. Stallman (Author), Gcc Developercommunity (Author), 638 pages, ISBN-13:  978-1441412768, ISBN-10:  144141276X.

 

Until Next Time – Keep the “C” in Coding!

versalytics-logo

One Reply to “Code::Blocks – TDM-GCC Installation – Part 1 of 2”

Leave a Reply