-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
>>- -qinclude--=--file_path------------------------------------><

Defaults

Not applicable.

Parameters

file_path
The absolute or relative path and name of the header file to be included in the compilation units being compiled. If file_path is specified with a relative path, the search for it follows the sequence described in Directory search sequence for include files.

Usage

-qinclude is applied only to the files specified in the same compilation as that in which the option is specified. It is not passed to any compilations that occur during the link step, nor to any implicit compilations, such as those invoked by the option -qtemplateregistry, nor to the files generated by -qtempinc.

When the option is specified multiple times in an invocation, the header files are included in order of appearance on the command line. If the same header file is specified multiple times with this option, the header is treated as if included multiple times by #include directives in the source file, in order of appearance on the command line.

C++ only When used with -qtemplateregistry, -qinclude is recorded in the template registry file, along with the source files affected by it. When these file dependencies initiate recompilation of the template registry, the -qinclude option is passed to the dependent files only if it had been specified for them when they were added to the template registry.

If you generate a listing file with -qsource, the header files included by -qinclude do not appear in the source section of the listing. Use -qshowinc=usr or -qshowinc=all in conjunction with -qsource if you want these header files to appear in the listing.

Any pragma directives that must appear before noncommentary statements in a source file will be affected; you cannot use -qinclude to include files if you need to preserve the placement of these pragmas.

Predefined macros

None.

Examples

To include the files foo1.h and foo2.h in the source file foo.c, enter:
xlc -qinclude=foo1.h foo.c  -qinclude=foo2.h

Related information