2.3 Default compiler behavior

By default, the compiler determines the source language by examining the source filename extension. For example, filename.c indicates C, while filename.cpp indicates C++, although the command-line options --c90, --c99, and --cpp let you override this.

The default compiler target instruction set depends on the target processor (--cpu=name):

  • For processors that support ARM instructions, the default instruction set is ARM. Use the --thumb command-line option to specify Thumb®.
  • For processors that do not support ARM instructions, the default instruction set is Thumb.

When you compile multiple files with a single command, all files must be of the same type, either C or C++. The compiler cannot switch the language based on the file extension. The following example produces an error because the specified source files have different languages:

armcc -c test1.c test2.cpp

If you specify files with conflicting file extensions you can force the compiler to compile both files for C or for C++, regardless of file extension. For example:

armcc -c --cpp test1.c test2.cpp

Where an unrecognized extension begins with .c, for example, filename.cmd, an error message is generated.

Support for processing Precompiled Header (PCH) files is not available when you specify multiple source files in a single compilation. If you request PCH processing and specify more than one primary source file, the compiler issues an error message, and aborts the compilation.

armcc can in turn invoke armasm and armlink. For example, if your source code contains embedded assembly code, armasm is called. armcc searches for the armasm and armlink binaries in the following locations, in this order:

  1. The same location as armcc.

  2. The PATH locations.

Related concepts
4.24 Precompiled Header (PCH) files
2.4 Order of compiler command-line options
2.9 Factors influencing how the compiler searches for header files
2.11 Compiler search rules and the current place
2.12 The ARMCC5INC environment variable
2.2 Compiler command-line options listed by group
2.1 Compiler command-line syntax
Related tasks
2.5 Using stdin to input source code to the compiler
Related reference
2.7 Filename suffixes recognized by the compiler
2.8 Compiler output files
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.