# Get started

This chapter shows how to build and execute a simple C program using
the LLVM compiler. The program is built in the Linux environment, and
executed directly on Armv7 or Armv8 hardware running Linux.

The Android NDK is assumed to be already installed on your computer.
The installation includes the tools required for assembling and
linking a compiled program.

Note

The commands shown in this chapter are for illustration
only. For detailed information on building programs, see
[Use the compilers](https://docs.qualcomm.com/doc/80-VB419-99/topic/use_the_compilers.html).

## Create source file

Create the following C source file:

#include <stdio.h>
    
    int main()
    
    {
    
    printf(“Hello world\\n”); return(0);
    
    }
    Copy to clipboard

Save the file as *hello.c*.

## Compile program

Compile the program with the following command:

`clang hello.c -o hello`

This command translates the C source file hello.c into the executable
file hello.

Note

When compiling with a GCC sysroot, see [Use GCC cross-compile environments](https://docs.qualcomm.com/doc/80-VB419-99/topic/use_the_compilers.html#sec-use-gcc-cross-compile-environments) for additional details.

## Execute program

To execute the program, use the following command:

`hello`

The program outputs its message to the terminal:

Hello world

You have now compiled and executed a C program using the LLVM
compiler. For more information on using the compiler, see [Use the compilers](https://docs.qualcomm.com/doc/80-VB419-99/topic/use_the_compilers.html).

Last Published: May 10, 2024

[Previous Topic
Functional overview](https://docs.qualcomm.com/bundle/publicresource/80-VB419-99/topics/functional_overview.md) [Next Topic
Use the compilers](https://docs.qualcomm.com/bundle/publicresource/80-VB419-99/topics/use_the_compilers.md)