INCLUDE | NOINCLUDE

Category

Compiler input

Pragma equivalent

None.

Purpose

Specifies additional header files to be included in a compilation unit, as though the files were named in consecutive #include "file" statements inserted before the first line of the source file.

The header files specified with the INCLUDE option are inserted before the first line of the source file.

This option simplifies the task of porting code across supported platforms by providing a way to affect the processing of the source code without having to change it.

Syntax

Read syntax diagramSkip visual syntax diagram
   .-NOINCLUDE-----------.   
>>-+-INCLUDE--(--file--)-+-------------------------------------><

Defaults

NOINCLUDE, which ignores any INCLUDE options that were in effect prior to NOINCLUDE. The NOINCLUDE option does not have suboptions.

Parameters

file
The name of a header file to be included at the beginning of the source file being compiled.

Usage

This option is applied only to the files specified in the same compilation as if it was specified for each individual file. It is not passed to any compilations that occur during the link step.

If you specify the option multiple times, the header files are included in order of appearance. If the same header file is specified multiple times with this option, the header is treated as if it was included multiple times by #include directives in the source file.

The file specified with the INCLUDE option is searched for first in the current directory when compiling in USS. If the file is not found in the current directory or when compiling in batch, the file is searched for as if it was included by an #include directive in the source file.

The files specified with the INCLUDE option will be included as a dependency of the source file if the -M or MAKEDEF option is used to generate information to be included in a "make" description file.

When a dependency file is created as a result of a first build with the INCLUDE option, a subsequent build without the INCLUDE option will trigger recompile if the header file on the INCLUDE option was touched between the two builds.

The files specified with the INCLUDE option will show up in the "INCLUDES" section of the compiler listing file that is generated by the LIST and SOURCE options, similar to how they would as if they were included by #include "file_name" directives.

IPA effects

None.

Predefined macros

None.

Examples

The following file t.h is a predefined header file:
#define STRING "hello world"
The following source file t.c is to be compiled:
int main () {
  printf ("%s\n", STRING);
  return 0;
}
To compile t.c by specifying t.h with the INCLUDE option, enter:
xlc t.c -qinclude=stdio.h -qinclude=t.h
./a.out
The following output is produced:
hello world