I'm having trouble getting clang++ to work as I compile my code. Specifically, I'm getting a make: clang++: Command not found
error.
I've run sudo apt-get install llvm
, and also sudo apt-get install build-essential
and sudo apt-get update
. What do I have to do to get clang++ installed?
Installing the
llvm
andbuild-essential
packages, as you have done, does not causeclang
orclang++
to be installed. For that, you must install one of the clang packages, depending on which version ofclang
andclang++
you want.16.04
In Ubuntu 16.04, your options are clang-3.5, clang-3.6, clang-3.7, and clang-3.8.
14.04
In Ubuntu 14.04, your options are clang-3.3 , clang-3.4 , and clang-3.5 .
You can install them in the Software Center, or with:
(Replacing
n
with the desired sub-version, of course.)12.04
If you're running Ubuntu 12.04, there's only one package that provides
clang
andclang++
, so it's just called clang .18.04 (Bionic)
I visited http://apt.llvm.org/bionic/dists/ (i.e. bionic distributions).
I determined that 6.0 was the latest major version of the toolchain.
I assume that you'll want the linker, lld, also.
This gives you binaries with the following names (and more, probably):
It also installs these packages (and more):
17.04 (Artful)
Same as above. I'll repeat every line for convenient copy-paste.
16.04 (Xenial)
The accepted answer already gives instructions for installing clang-3.8 on 16.04, but here's how to get clang-6.0:
Before proceeding it will be worthwhile to update package information using
sudo apt-get update
Installing Clang 9 on Ubuntu 18
sudo apt-get install clang-tools-9
It will also install llvm-9
For more information follow clang documentation.
Installing Clang 10 on Ubuntu 18
sudo apt-get install clang-tools-10