Instructs the compiler to treat all recognized source files as if they are the source type specified by this option, regardless of actual source file name suffix.
.-default------------. >>- -q--sourcetype--=--+-c------------------+------------------>< +-c++----------------+ +-assembler----------+ '-assembler-with-cpp-'
where:
Source type | Suffix | Behavior |
---|---|---|
default | - | The compiler assumes that the programming language of a source file will be implied by its file name suffix. |
c |
|
The compiler compiles all source files following this option as if they are C language source files. |
c++ |
|
The compiler compiles all source files following this option as if they are C++ language source files. |
assembler |
|
The compiler compiles all source files following this option as if they are assembler language source files. |
assembler-with-cpp |
|
The compiler compiles all source files following this option as if they are Assembler language source files that needs preprocessing. |
Ordinarily, the compiler uses the file name suffix of source files specified on the command line to determine the type of the source file. For example, a .c suffix normally implies C source code, a .C suffix normally implies C++ source code, and the compiler will treat them as follows:
The -qsourcetype option instructs the compiler to not rely on the file name suffix, and to instead assume a source type as specified by the option. This applies whether the file system is case-sensitive or not. However, in a case-insensitive file system, the above two compilations refer to the same physical file. That is, the compiler still recognizes the case difference of the file name argument on the command line and determines the source type accordingly, but will ignore the case when retrieving the file from the file system.
Note that the option only affects files that are specified on the command line following the option, but not those that precede the option. Therefore, in the following example:
xlc goodbye.C -qsourcetype=c hello.Chello.C
is compiled as a C source file, but goodbye.C is compiled as a C++ file.
The -qsourcetype option should not be used together with the -+ option.
To treat the source file hello.C as being a C language source file, enter:
xlc -qsourcetype=c hello.C
Related information