Clang Compilation - learnclang/1-helloworld GitHub Wiki

If you followed the steps in Preparing your environment, there are just a few packages we will need to install in order to get Clang up and running.

To install Clang

  1. Run this from a terminal
$ sudo apt-get install build-essential llvm clang

Once that's done, you should now be able to run clang, which will act much like gcc.

Compiling

Now we can compile our file written in Writing hello world.

$ clang hello.c

And run it, like so:

$ ./a.out
Hello, World!

Return Home