How do I install gcc 6 (latest 6.1?) on Ubuntu 14.04 LTS, make c++14 the default and will my libraries work? Also, what problems can I expect if any? Lastly, please walk me through this because i am rather new at Linux and programming.

  • 1
    This is not a duplicate. gcc 5 or 6 is not that easy to install into 14.04.
    – Pilot6
    May 28, 2016 at 7:35
  • @Pilot6: Worked like a charm here. May 28, 2016 at 9:13
  • I saw that answer but struggled with dependencies. Maybe it is fixed in repositories now.
    – Pilot6
    May 28, 2016 at 9:46

1 Answer 1


You can add a repository that contains the latest GCC and then simply install it via sudo apt install gcc (I've provided a link). Alternatively, you can build the latest GCC from source (this is just an example, read the README and INSTALL file):

$> # download the latest gcc tar file and extract
$> ./configure
$> make
$> sudo make altinstall


If you're just playing around with a system and/or Ubuntu is running in a VM (Virtualbox, VMWare, QEMU, etc) then the side effects are negligible and you probably won't care. However if you're on some sort of production server that "needs to always work" than you might run into issues that require a certain version of GCC. In this case, you should make an alternative install (ie. make altinstall) when building from source or use a verified package.


  • The second link has been very useful to me.
    – Enlico
    Aug 7, 2016 at 6:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.