Questions tagged [clang]

Clang is a C/C++ language compiler frontend for LLVM.

Clang is a compiler front end for the C, C++, Objective-C and Objective-C++ programming languages. It uses LLVM as its back end and has been part of its releases since LLVM 2.6.

The goal of the project is to offer a replacement to the GNU Compiler Collection (GCC).

121 questions
51
votes
4 answers

How to install clang++?

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…
user313944
  • 1,631
  • 2
  • 12
  • 8
37
votes
8 answers

clang and clang++ not found after installing the clang-3.5 package

After installing the clang-3.5 package, typing clang or clang++ on the command line gives me a message stating which packages those programs can be found in. Attempting to run the install of clang-3.5 again, apt states it's already installed and at…
35
votes
4 answers

How to install gcc-7 or clang 4.0?

I want to try C++17 features and I want to install standard compliant compiler (preferably GCC). I'm totally new to Linux and Ubuntu and I simply don't understand a lot. I tried to follow…
nikitablack
  • 545
  • 2
  • 5
  • 8
32
votes
3 answers

How to install LLVM 3.9

I'm working with Emscripten and one of the error messages is: LLVM version appears incorrect (seeing "3.3", expected "3.9") But I can't find 3.9 on the LLVM page: http://llvm.org/releases/download.html#3.8.0 What can I do to install LLVM 3.9?
25
votes
6 answers

Installing clang 6.0 on Ubuntu 18.04 LTS Bionic

How can I install clang on Ubuntu 18.04 LTS Bionic?
Bluetake
  • 279
21
votes
3 answers

Set clang-3.8 as default

I have installed clang 3.0 and clang 3.8: $ sudo update-alternatives --config clang update-alternatives: error: no alternatives for clang. How can I set 3.8 as /usr/bin/clang?
Andrew
  • 739
21
votes
2 answers

clang++ cannot find iostream

Here is a simple code : #include #include #include #include #include #include #include int main() { std::cout << "Hello, world!" << std::endl; return 0; } when I…
Thomas
  • 621
19
votes
2 answers

How to set Clang 9 as the default C++ compiler on Ubuntu 19.10?

how do I set Clang 9 as the default C++ compiler on Ubuntu 19.10? I searched the internet, but nothing helped. Thank you for answer :)
user1027802
17
votes
1 answer

Installing clang 5.0 and using C++17

I have been trying for 3 days to install clang 5.0 on an Ubuntu 16.04 machine. I have tried various guides, but nothing seems to work. When I try to simply grab the latest from SVN and build/install (as detailed here), trying to compile a simple…
Steve D
  • 267
17
votes
1 answer

llvm and clang installation on ubuntu

So I'm trying to install Halide on my Ubuntu 12.04 (64bit). I need llvm-3.2 and clang to be installed. Running sudo apt-get install llvm-3.2 ends up with 'package not found'. Trying sudo apt-get install llvm or sudo apt-get install clang installs…
Andrei Ivanov
  • 311
  • 1
  • 3
  • 4
17
votes
1 answer

How do I backport/install a newer version of clang?

I just want to install the newest version of clang http://packages.ubuntu.com/raring/clang-3.2 Does this mean I have to update my kernel to raring?
Maik Klein
  • 1,321
15
votes
1 answer

Installing clang 3.8 on Ubuntu 14.04.3

I've tried the following obvious commands: sudo apt-get update sudo apt-get install clang-3.8 but I get the message: Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to…
A Frayed Knot
  • 253
  • 1
  • 2
  • 5
14
votes
1 answer

How can Clang static analyzer (scan-build) be installed on Ubuntu 18.04?

In Ubuntu 16.04, I could: $ sudo apt install clang $ scan-build --help USAGE: scan-build [options] [build options] ... But in Ubuntu 18.04, after installing clang, the scan-build executable is not installed. How can I use apt to…
13
votes
2 answers

How to compiler OpenMP program using clang?

My gcc compiles well, but clang fails with the following message: clang -fopenmp=libomp -o main main.c main.c:5:10: fatal error: 'omp.h' file not found I also installed libomp5 package and changed flag to -fopenmp=libomp5 , though it didn't help…
anon
13
votes
1 answer

How to install Clang 16 on 22.04 LTS

I have 22.04 LTS but I'd like to install a later Clang, version 16. How can I install this? (22.04 doesn't come with Clang 16 in the repos) UPDATE Whilst I appreciate the answer below, I found a much simpler way from…
1
2 3
8 9