Installing C++11 compiler on Ubuntu?

tsaarni picture tsaarni · Dec 6, 2011 · Viewed 30.5k times · Source

What is the simplest way to get most up-to-date C++11 compiler on Ubuntu 11.04 without breaking the existing compiler from the distribution. I'd prefer pre-built package instead of compiling whole toolchain myself.

Answer

Hauleth picture Hauleth · Dec 6, 2011

GCC 4.6 provides most of the C++11 features. One has only to add the flag -std=c++0x and can use range based for loops, strong enums, UTF strings, etc. For the list of features available in a given version of GCC one can check on http://gcc.gnu.org/projects/cxx0x.html.