Introduction to C++11 Toolchains

This article is part 1 of a 4 part series on the benefits of the C++11 revision of the C++ programming language:

The C++11 standard has been with us for quite a while, but it hasn’t yet gained traction as significantly as one might expect. It’s a shame as there are many reasons to utilize C++11 features, and the toolchain support is pretty good, especially on Unix-like systems with Windows finally catching up.

I decided to write a series of articles to advertise the benefits of C++11 and provide an explanation of some of the new features. I found various resources on the web that are quite misleading, so I feel it is important to clarify some things. This article will focus on three of the popular toolchains used for compiling C++ programs.

Toolchain Coverage

C++11 toolchain support seems to be pretty good. These are the main three compilers most people aim to support. I’ll explain each of these in order.

  • GCC
  • Clang
  • MS Visual C++


GCC is GNU’s C/C++ compiler, but it also supports other languages such as Objective C, Fortran, Ada or Go. It was one of the first truly free software compilers and is among the best compilers overall in terms of performance.

GCC benefits:

  • It has a stable, mature codebase with relatively few bugs and a very advanced and powerful optimizer.
  • It’s a free software compiler, so its source code is available for anyone to study and improve.
  • It’s portable to a very wide range of operating systems and architectures.
  • It provides a lot of useful extensions for the languages it supports (mainly C/C++).

GCC disadvantages:

  • Since it’s very old, it has a lot of code bloat that it’s accumulated since its creation; it has become fairly difficult to maintain.
  • It’s not very modular and has inferior error diagnostics compared to some other compilers.
  • Its licensing under the GPL can be an issue.
  • Its useful language extensions make it very easy to abuse and write non-portable code (this can be avoided with the right compiler options).

Despite its flaws, GCC is a compiler you should target. Its maturity makes it a very reliable choice, especially for compiling release binaries. It has also achieved complete C++11 feature coverage in the 4.8 release, meaning it will work very well in various operating systems. For example, the latest LTS version of Ubuntu ships with version 4.8.2, the current stable release of Debian provides version 4.9.2, and most other Linux distributions are also similarly up to date.

GCC is also relevant outside of the Linux world. The ports collection in FreeBSD ships GCC versions all the way up to the latest version (5.2 at the time of writing), the other BSDs and other Unix-like operating systems are also sufficiently up to date. Finally, MinGW-w64 on Windows currently targets the 4.9 branch of GCC and TDM-GCC provides 5.1.

Varying levels of C++11 support have been present long before the 4.8 release, ever since 4.3 (when it was still called C++0x).


Clang is a C/C++/ObjC compiler developed as part of the LLVM project. LLVM aims to provide a clean, cross platform framework for programming language implementations, and is backed by some major companies. Tilmann Scheller, an LLVM developer from Samsung’s UK Open Source Group, previously wrote a two-part post on Clang.

Clang benefits:

  • Very fast development with many external contributors from major companies.
  • Clean architecture that allows for easy development as well as very powerful optimizations.
  • Liberally licensed under the BSD-style NCSA license.
  • Very portable, with its clean design allowing for new ports.
  • Highly modular since everything is split. Many language implementations are now based on LLVM with Clang being just one of them.
  • Nearly complete drop-in replacement for GCC, that supports its external interface as well as all GCC language extensions.
  • New language features usually get incorporated more quickly than GCC.
  • Awesome error diagnostics and fast compilation speeds.

Clang drawbacks:

  • Sometimes it generates code that’s a bit slower than GCC, but this is constantly being improved.
  • Its OpenMP support is currently lacking. It was recently imported for the first time and is not up to date with the newest version.
  • Platform/architecture support is currently a bit worse than GCC’s, however most relevant functionality is covered.

I highly recommend making use of Clang’s error reporting, static analyzer, and other features; they can result in a major boost to your productivity. Since GCC generates slightly better binaries, you could use Clang as your main development compiler and GCC as a release compiler, although this will depend on the project. My recent tests with latest development version of Clang indicate it no longer makes a significant difference for most codebases.

Clang has achieved feature-completeness for C++11 earlier than GCC, with version 3.3 having complete coverage, and even previous versions (such as 3.1) supporting most of the features. Additionally, Clang 3.4 boasts complete C++14 support, something GCC only achieved with their latest release, version 5.1. I’ve found significant bugs while testing GCC that are still present even in the most recent version, so I wouldn’t recommend it for C++14 yet.

It’s worth mentioning that Clang is the default compiler on OS X, shipping with Xcode by default. Additionally, it’s also the default compiler of the BSD world, with the exception of DragonflyBSD, and is used widely on Linux. The vast majority of Linux distributions provide at version 3.3 or newer, which is sufficient for C++11. The BSDs, OSX, etc. typically offer a much more recent version.

Microsoft seems to be counting on it as well, with the newest version of Visual Studio supporting it for deployment of Linux applications with future plans to enable it for Windows desktop apps as well. Additionally, Clang provides a clang-cl.exe driver on Windows, that provides MS Visual C++ frontend compatibility, and implements most of MS Visual C++ extensions.

Microsoft Visual C++

Microsoft maintains their own compiler as part of the Visual Studio suite. Unlike the former two, it’s proprietary and only targets Windows. However, there is still a reason to use it since it provides the default C/C++ runtime that is used on Windows.

Microsoft Visual C++ benefits:

  • “Native” Windows runtime support with no dependencies on external libraries like GCC’s runtime.
  • It helps avoid overusing GCC/Clang extensions, and the ability to target multiple runtimes makes it easier to find potential bugs.
  • Integration with the Visual Studio IDE. Whether this is an advantage or not is for you to decide.

Microsoft Visual C++ drawbacks:

  • It’s slower with fewer features than Clang and GCC.
  • C++11 support is currently incomplete.
  • It’s proprietary and only targets Windows.

Its support has been lackluster, but it improving. With Visual Studio 2015, C++11 support is nearly complete. It’s missing one significant feature, Expression SFINAE, which will be covered in a future article in this series. Microsoft has promised to deliver an update during the year which will feature Expression SFINAE as well as further updates from C++14 and C++17. However, it’s in the realm of possibility that Microsoft will eventually abandon it in favor of Clang.

Other than the runtime, there aren’t many reasons to use Visual C++. Depending on how your code is written, adding support for it can be easy or very painful. However, if you target all 3 main toolchains, you can be mostly sure that your program is written with portable language, which is always a good thing.


There are many other C++ compilers around, but they’re mostly niche and target specific platforms or extensions. Exceptions include the Intel C++ compiler and the PathScale C++ compiler, which are solid and high performance general purpose compilers. However,  it doesn’t really make much sense for most people to use them.

Next time

I hope this article has provided some valuable insight into the C++11 toolchains that are out there for you to use. This knowledge sets the stage for the next articles in the series that will describe some of the most important features of the C++11 language. Stay tuned to this blog to learn about all of the great benefits of C++11!

Author: Daniel Kolesa

Daniel has been contributing to open source since 2007 and has been involved with the EFL and the OctaForge 3D game engine in addition to other projects.