The GNU Compiler Collection, commonly known as GCC, is a set of compilers and development tools available for Linux, Windows, various BSDs, and a wide assortment of other operating systems.

Use GCC with Incredibuild

What is GCC?

The GNU Compiler Collection, commonly known as GCC, is a set of compilers and development tools available for Linux, Windows, various BSDs, and a wide assortment of other operating systems. It includes support primarily for C and C++ and includes Objective-C, Ada, Go, Fortran, and D. The Free Software Foundation (FSF) wrote GCC and released it as completely free (as in libre) software.

History of GCC

On Sunday, March 22nd of 1987, Richard M. Stallman (known to the IT world as RMS) released GCC to the world and invited others to help him test it. During the next decade, the project was forked into a compiler named EGCS. In April of 1999, the projects were merged again and became part of the GNU Project and renamed the GNU Compiler Collection.

The GCC Steering Committee governs the project and makes regular releases. As of this writing, the latest version is 10.2, released on March 19th of 2021.

How does it work?

GCC is a toolchain that compiles code, links it with any library dependencies, converts that code to assembly, and then prepares executable files. It follows the standard UNIX design philosophy of using simple tools that perform individual tasks well. The GCC development suite utilizes these discrete tools to compile software.

When you run GCC on a source code file, it first uses a preprocessor to include header files and discard comments. Next, it tokenizes the code, expands macros, detects any compile-time issues, then prepares it for compilation. It is then sent to the compiler, which creates syntax trees of the program’s objects and control flow and uses those to generate assembly code. The assembler then converts this code into the binary executable format of the system. Finally, the linker includes references to any external libraries as needed. The finished product is then executable on the target system.

Try it now

Get Free License

How to download GCC?

Nearly all Linux distributions either come pre-installed with GCC or have it in their primary repositories, making it easy to install. On Debian-based distributions like Debian, Ubuntu, and Linux Mint, run “apt install build-essentials”. On RedHat-based distributions like RedHat Enterprise Linux, Fedora, CentOS, and Amazon Linux, run “yum group install ‘Development Tools’”. On Arch-based distribution like Arch and Manjaro, run “pacman -S base-devel”.

macOS users can install GCC via brew with “brew install gcc”.

For Windows instructions, see the section titled GCC for Windows.

GCC features

GCC offers a wealth of features to developers, including multiple language support, in-depth code optimization, and cross-platform compilation.

GCC examples

Compiling a program with GCC can be a straightforward matter/

gcc hello.c -o hello

Running this command processes the hello.c file and generates a binary called “hello”. Additional parameters can be passed.

gcc hello.c -O3 -o hello

In this example, the optimization parameter is set to 3, leading to more optimized code generation.

Additional libraries can be included as well.

gcc hello.c -lncurses -o hello

This example includes the ncurses library.

More complex compilations are managed by Makefiles and are invoked with the “make” command.

GCC for Windows

Windows have two options—either install Windows Subsystem for Linux (WSL) and install their distribution of choice, then follow the directions above, or use the MinGW (Minimalist GNU for Windows) distribution available from https://mingw-w64.org.

The WSL option allows for a more Linux-like experience when using GCC. Since modern WSL versions run a native Linux system, developers may have little to no deviation in their workflow when using this environment. Since WSL is a virtualized technology, there is some performance overhead. Additionally, graphical programs may not run or run with performance or feature impairment, so MinGW-W64 may better serve developers needing to compile GUI-based software.

GCC for Linux

GCC is the heart of the GNU toolchain, the development system used to compile most Linux and open-source software. While there are a few specialty distributions that omit GCC, you will find it in nearly every Linux system. The Linux kernel itself is primarily compiled with GCC. The Linux kernel and the GNU toolchain share such a long history that the Linux ecosystem is commonly called GNU/Linux.

GCC Advantages

  • Perhaps GCC’s most significant advantage is its license—the GPL (General Public License) version 3, giving users essential software freedoms. The Free Software Foundation backs the project, and GCC enjoys a large community of developers, contributors, and support ecosystem.
  • GCC’s modular design allows for easier troubleshooting and source code maintenance and a shorter implementation curve for new features.

GCC and Incredibuild

GCC is fast, but Incredibuild makes GCC even faster. Incredibuild turbocharges development with Virtualized Distributed Processing™ technology, turning every host into a supercomputer with hundreds of cores. With Incredibuild, accelerated product development from compilation to testing and release automation delivers better products to market radically faster.


Bottom line

GNU/Linux, open-source software, and much of the internet’s software backbone rely on the GNU Compiler Collection’s power and versatility.

Get Free License

More Compilers