3.6.2.7 X: Specify Source Language Option
The -x language
option specifies the language for the sources files that follow on the command line.
The compiler usually uses the extension of an input file to determine the file’s content. This option allows you to have the language of a file explicitly stated. The option remains in force until another language is specified with a -x
option, or the -x none
option, which turns off the language specification entirely for subsequent files. The allowable languages are tabulated below.
Language | File language |
---|---|
assembler | Assembly source |
assembler-with-cpp | Assembly with C preprocessor directives |
c | C source |
cpp-output | Preprocessed C source |
c-header | C header file |
none | Based entirely on the file’s extension |
The -x assembler-with-cpp
language option ensures assembly source files are preprocessed before they are assembled, thus allowing the use of preprocessor directives, such as #include
, and C-style comments with assembly code. By default, assembly files not using a .S extension are not preprocessed.
xc8-cc
-mcpu=atmega3290p
-x c-header init.h
will create the precompiled header called init.h.gch.