include

Syntax

INCLUDE '<file>'

Meaning

If you insert this statement in an .ada file, then during compilation of the current .ada file, the contents from the file (usually with the .inc extension) will be included. The contents of the .inc file will be inserted virtually into the line following the INCLUDE statement. The compiler will compile the file and then continue compilation of the current file. This means that it matters where you place the include statement: if the .inc file only contains subroutines, then in the main .ada file you must place the include statement after (below) the end statement because subroutines must always be specified after the end statement, while if the .inc file only contains code without subroutines then the include statement in the .ada file must be located somewhere before the end statement, just before it or just below the variable declarations or opening of FACS databases for example. So during compilation the code from the .inc file is inserted where it is called. The file may be preceded by a disk or volume name and a folder path name. Single quotes around the file name are compulsory. Also, .inc files typically do not contain an end statement.
Since the contents of the .inc file will be inserted virtually into the line following the INCLUDE statement, that line should be completely empty and should not contain any spaces or tabs. If that line does contain spaces or tabs and the first line of the include file is not empty (because it starts with an asterisk for example), you will get a compilation error on the first line of the include file, because the asterisk will be inserted after the spaces or tabs, but an asterisk is only allowed in the first position of a line.
It is not allowed to end this statement with a semi-colon, but you must end it with a hard return if it is the last statement in the .ada file.
Note that for compilation of an .ada file with an include statement that points to a file without any full path in front of it, it is important to start compilation from within the folder that contain both the .ada and .inc files, otherwise compilation will report that it can't find the include file.
Also be aware that any variable declared in the .inc file should not be declared in the main .ada file too: a variable declared in the main file will be accessible to functions in the .inc file too.

Example

include 'force.inc'