-include (-qinclude)

Category

Input control

Pragma equivalent

None.

Purpose

Specifies additional header files to be included in a compilation unit, as though the files were named in an #include statement in the source file.

The headers are inserted before all code statements and any headers specified by an #include preprocessor directive in the source file. This option is provided for portability among supported platforms.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -include--file---------------------------------------------><

Read syntax diagramSkip visual syntax diagram
        .-noinclude---------.   
>>- -q--+- include--=--file-+----------------------------------><

Defaults

None.

Parameters

file
The header file to be included in the compilation units being compiled.

Usage

Firstly, file is searched in the preprocessor's working directory. If file is not found in the preprocessor's working directory, it is searched for in the search chain of the #include directive. If multiple -include (-qinclude) options are specified, the files are included in order of appearance on the command line.

Predefined macros

None.

Examples

To include the files test1.h and test2.h in the source file test.c, enter the following command:
xlc -include test1.h -include test2.h test.c


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us