Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 507
mort Avatar asked May 30 '15 17:05

mort


People also ask

How do I find my clang version in Ubuntu?

Open a terminal window. Enter the command (clang — version) to confirm if the Clang Compilers had already been installed.

Where is clang installed?

Use the default install location: C:\Program Files (x86)\LLVM and complete the installation. clang++.exe should be located in C:\Program Files (x86)\LLVM\bin , but should NOT be in your system path.

How do I install the latest version of clang on Ubuntu?

To open up a terminal window on Ubuntu, press Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Once the terminal window is open and ready to use, enter the apt install command and install the “clang-12” package, along with the –install-suggests command-line switch, which grabs all suggested packages.


1 Answers

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 
like image 169
Huy Le Avatar answered Sep 18 '22 09:09

Huy Le