sudo apt update && sudo apt upgrade 3. Install GCC 8 and Clang 6.0:
$
sudo apt install g++-8 clang-6.0 4. Test GCC and Clang:
$
g++-8 –version g++-8 (Ubuntu 8-20180414-1ubuntu2) 8.0.1 20180414 (experimental) [trunk
revision 259383]
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
$
clang++-6.0 --version clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
If either command returns an error stating that the command wasn’t
found, the corresponding compiler did not install correctly. Try searching
for information on the error you receive, especially in the documentation
and forums for your respective package manager.
Installing GCC from Source If you can’t find the latest GCC or Clang versions with your package man-
ager (or your Unix variant doesn’t have one), you can always install GCC
from source. Note that this takes a lot of time (as much as several hours),
and you might need to get your hands dirty: installation often runs into
errors that you’ll need to research to resolve. To install GCC, follow the
instructions available at https://gcc.gnu.org/. This section summarizes the
far more extensive documentation available on that site.
N O T E For brevity, this tutorial doesn’t detail Clang installation. Refer to https://clang
.llvm.org/ for more information. To install GCC 8.1 from source, do the following:
1. Open a terminal.
Up and Running
11 2. Update and upgrade your currently installed packages. For example,
with APT you would issue the following command:
$