GCC and Make
FreeGNU Compiler Collection – Compiling, Linking and Building C/C++ Applications
FreeFree tier
About GCC and Make
GCC (GNU Compiler Collection) is a key component of the GNU Toolchain, providing a suite of compilers for languages such as C, C++, Objective-C, Fortran, Ada, Go, and more. Originally developed by Richard Stallman, GCC supports cross-compilation, multiple C++ standards (C++98, C++11, C++14, C++17, C++2a), and runs on Unix, macOS, and Windows (via Cygwin, MinGW). GNU Make is an automation tool for building applications from source code. This tutorial covers compiling, linking, and building C/C++ applications using GCC and Make.
Key Features
Supports multiple languages: C, C++, Objective-C, Objective-C++, Java, Fortran, Ada, Go, and more
Cross-compilation support for producing executables on different platforms
Part of the GNU Toolchain including Make, Binutils, GDB, Autotools
Portable across Unix, macOS, and Windows (Cygwin, MinGW, MinGW-W64)
Command-line flags to specify C++ standards (-std=c++11, -std=c++14, etc.)
Free and open-source software
Pros & Cons
Pros
- Free and open-source with a large community
- Portable across multiple operating systems
- Supports many programming languages and standards
- Highly optimized code generation
- Integrates with other GNU tools for a complete development environment
Cons
- Steep learning curve for beginners unfamiliar with command-line tools
- Command-line based; no built-in graphical user interface
- Complex build configurations may require Makefiles or other build systems
Best For
Compiling and building C/C++ applicationsCross-compiling for different target platformsLearning compilation process and toolchainsAutomated build processes with GNU MakeDeveloping system software and operating systems
FAQ
What is GCC?
GCC stands for GNU Compiler Collection. Originally the GNU C Compiler, it now supports many languages including C, C++, Objective-C, Java, Fortran, Ada, and Go. It is a key component of the GNU Toolchain.
What languages does GCC support?
GCC supports C (gcc), C++ (g++), Objective-C, Objective-C++, Java (gcj), Fortran (gfortran), Ada (gnat), Go (gccgo), and more with extensions like OpenMP, Cilk Plus, and OpenAcc.
How do I specify a C++ standard in GCC?
Use the -std flag, for example -std=c++11, -std=c++14, -std=c++17, or -std=c++2a for the next standard. The default is C++14 for GCC 6.1 and above, and C++98 for older versions.
Is GCC available on Windows?
Yes, GCC can be installed on Windows via Cygwin, MinGW, or MinGW-W64. These provide a Unix-like environment with GCC and related tools.