# Use the compilers The LLVM compilers translate C and C++ programs into Hexagon processor code. C and C++ programs are stored in source files, which are text files created with a text editor. Hexagon processor code is stored in object files, which are executable binary files. ## Start the compilers To start the C compiler from the command line, enter: hexagon-clang [] Copy to clipboard To start the C++ compiler from the command line, enter: hexagon-clang++ [] Copy to clipboard The compilers accept one or more input files on the command line. Input files can be C/C++ source files or object files. For example: hexagon-clang hello.c mylib.c Copy to clipboard Command switches are used to control various compiler options (see [Compiler options](https://docs.qualcomm.com/doc/80-N3040-23/topic/use-the-compilers.html#hccpp-compilers-compiler-options)). A switch consists of a dashcharacter (`-`) followed by a switch name and optional parameter. Switches are case-sensitive and must be separated by at least one space. For example: hexagon-clang hello.c -o hello Copy to clipboard To list the available command options, use the –help option: hexagon-clang --help hexagon-clang++ --help Copy to clipboard This option causes the compiler to display the command line syntax, followed by a list of the available command options. clang is the name of the front-end driver for the LLVM framework. ## Input and output files The LLVM compilers preprocess and compile one or more source files into object files. The compilers then invoke the linker to combine the object files into an executable file. Following are the input file types and the tool that processes files of each type. The compilers use the filename extension to determine how to process the file. | Extension\*\* | Description\*\* | Tool\*\* | | --- | --- | --- | | `.c` | C source file | C compiler | | `.i` | C preprocessed file | C compiler | | `.h` | C header file | C compiler | | `.cc` | C++ source file | C++ compiler | | `.cp` | C++ source file | C++ compiler | | `.cxx` | C++ source file | C++ compiler | | `.cpp` | C++ source file | C++ compiler | | `.CPP` | C++ source file | C++ compiler | | `.c++` | C++ source file | C++ compiler | | `.C` | C++ source file | C++ compiler | | `.ii` | C++ preprocessed file | C++ compiler | | `.h` | C++ header file | C++ compiler | | `.hh` | C++ header file | C++ compiler | | `.H` | C++ header file | C++ compiler | | `.s` | Assembly source file | Assembler | | `.S` | Assembly source file | Assembler | | Other | Binary object file | Linker | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All filename extensions are case-sensitive literal strings. Input files with unrecognized extensions are treated as object files. For more information on assembly and object files, see the *Qualcomm Hexagon Utilities User Guide* (80-N2040-15). Following are the output file types and the tools used to generate each file type. Compiler options (see [Compiler options](https://docs.qualcomm.com/doc/80-N3040-23/topic/use-the-compilers.html#hccpp-compilers-compiler-options)) are used to specify the output file type. | File type | Default filename | Input files | | --- | --- | --- | | Executable file | `a.out` | The specified source files are compiled and linked to a single executable file. | | Object file | `file.o` | Each specified source file is compiled to a separate object file (where file is the source filename). | | Assembly source file | `file.s` | Each specified source file is compiled to a separate assembly source file (where file is the source filename). | | Preprocessed C/C++ source file | `stdout` | The preprocessor output is written to the standard output. | ## Compiler options The LLVM compilers can be controlled by command-line options (see [Start the compilers](https://docs.qualcomm.com/doc/80-N3040-23/topic/use-the-compilers.html#hccpp-compilers-start)). Many of the GCC options are supported, along with options that are LLVM-specific. Many of the `-f`, `-m`, and `-W` options can be written in two ways: `-f