mort mort - 5 months ago 16
Linux Question

Installed clang++3.6 on Ubuntu, can't select as alternative

I just installed clang++3.6 on my Ubuntu machine, but can't set it as the default c++ compiler.

sudo update-alternatives --config c++


tells me that

There is only one alternative in link group c++ (providing /usr/bin/c++): /usr/bin/g++
Nothing to configure.


and clang++ doesn't show up in

sudo update-alternatives --query c++


either (which was to be expected). But the compiler definitely works:

which clang++-3.6
/usr/bin/clang++-3.6


My OS version is Ubuntu 14.04.1 LTS.

What do I have to do to make
update-alternatives
include clang++3.6?


Note: I previously used clang3.4, but removed it since it doesn't support all c++11 feature I require. It seems that this is still the version installed when simply installing the clang++ package (I specifically installed clang++3.6);
update-alternatives
DID work for that version.

Answer

These work for me:

sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-3.6 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.6 100
Comments