You copied the Doc URL to your clipboard.

Generate executable binaries from C and C++ code

To generate an executable binary, compile a program using:

armclang -o example1 example1.c

You can also specify multiple source files on a single line. Each source file is compiled individually and then linked into a single executable binary:

armclang -o example1 example1a.c example1b.c

Compiling and linking object files as separate steps

To compile each of your source files individually into an object file, specify the -c (compile-only) option, and then pass the resulting object files into another invocation of armclang to link them into an executable binary.

armclang -c -o example1a.o example1a.c
armclang -c -o example1b.o example1b.c
armclang -o example1 example1a.o example1b.o

Increasing the optimization level

To increase the optimization level, use the -Olevel option. The -O0 option is the lowest optimization level, while -O3 is the highest. Arm® C/C++ Compiler only performs auto-vectorization at -O2 and higher, and uses -O0 as the default setting. The optimization flag can be specified when generating a binary, such as:

armclang -O3 -o example1 example1.c

The optimization flag can also be specified when generating an object file:

armclang -O3 -c -o example1a.o example1a.c
armclang -O3 -c -o example1b.o example1b.c

 or when linking object files:

armclang -O3 -o example1 example1a.o example1b.o