TDM-GCC Compiler Collection and Code::Blocks
A common question from beginning programmers is, “What kind of programs can I write with C++?” I asked myself the same question many years ago.
I learned through a quick Google search that Code::Blocks was written in C++ and wxWidgets was used to build the graphical user interface or GUI.” From that point on, I acquired an affinity to use Code::Blocks for my smaller projects.
At a minimum, every programming language requires the installation of a compiler and an editor. An IDE or interactive development environment allows you to edit, compile, debug and perform other tasks all from within the IDE itself making for a more efficient and effective development process.
Code::Blocks is an Open-Source, cross-platform IDE that supports a number of programming languages and is ideally suited for C, C++, and Fortran. If you are developing an application for more than one platform, having a common IDE that works on all of them is ideal.
As of this writing, the current version of Code::Blocks is 16.01. The Mac version of Code::Blocks has not been updated to this latest release due to the lack of Mac developers and remains at version 13.12.
Click on the Downloads tab on the menu bar: or click on the Downloads bullet point in the MAIN Sidebar Menu. The Downloads page appears and we are presented with several download options categorized as follows:
- Download the Binary Release
- Download the Source Code
- Retrieve Source Code From SVN
Downloading the binaries is the simplest of the options and is the method described here. Files are available for download for Windows, Linux 32-bit, Linux 64-bit, and Mac OS X.
Read the the notes in the applicable downloads section for your operating system. Since we are downloading for a Windows 10 machine, we have 6 files to choose from. We will be downloading the codeblocks-16.01mingw-setup.exe which includes Code::Blocks with all the plugins as well as the GCC/G++ compiler and GDB debugger from TDM-GCC.
NOTE: 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. For instruction on installing the TDM-GCC compiler collection separately, please visit part 1 of this series.
We opted for the codeblocks-16.01-setup.exe file. To download, click on either “Sourceforge.net” or “FossHub” to the right of the filename of your choosing. You will then be taken to the appropriate download page. In our case, click on SourceForge and the download will attempt to begin automatically.
A message will appear at the bottom of the screen prompting you to either Run, Save or Cancel. Since we will be running this as administrator, click the SAVE button.
After a few minutes the download will complete. Click on the “Open Folder” tab.
By default, the download folder should contain our setup file. Find and right click on the codeblocks-16.01mingw-setup.exe file and click on “Run as Administrator”.
A window will appear prompting you to “allow codeblocks-16.01mingw-setup.exe to make changes to your machine.” Click the Yes button and the “Welcome to CodeBlocks Setup Screen will appear:
Click the Next button and review the License Agreement before installing Code::Blocks on your machine. If the terms are acceptable, “Click on the I Agree button.”
The “Choose Components” window appears where you are presented with a list of components to be installed. By default, all are selected. Simply click the Next button to continue.
The “Choose Install” location window appears. The default location is acceptable in our case. You can either type of click the “Browse…” button to select an alternate location. When you’re ready to begin, click the “Install” button.
The installation process will commence …
After installing the files, a window appears asking “Do you want to run Code::Blocks now?
Click the Yes button and the “Installation Complete” window appears.
When the “Completing CodeBlocks Setup” window appears click the “Finish” button and Code::Blocks will launch if you clicked Yes to the earlier prompt.
A “File associations” window will appear noting that Code::Blocks is not the default application for C/C++ source files. In our case, I left everything as is since Visual Studio 2017 is my primary IDE for Windows application development.
Code::Blocks successfully launched: Release 16.01 rev 10702 (2016-01-25 19:40:14) gcc 4.9.2 Windows / unicode – 32 bit.
As mentioned earlier, the 32-bit GCC Compiler Collection is installed with Code::Blocks by default. Multiple versions of the TDM-GCC compiler collection can co-exist on your machine and Code::Blocks can easily be configured to recognize the new – or different – installation.
You have now successfully installed the Code::Blocks IDE 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:
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
Until Next Time – Keep the “C” in Coding!