Include Files

A Qore program can include other program code to be used and executed in the current program by using the %include directive. The %include directive must be the first text on the line, and the file name to include must follow. All text on the line after the %include directive will be used for the file name to include. The file name should not be quoted.

Here is an example:

#!/usr/bin/qore
%include /usr/qore/lib/functions.ql

After this, any variable, function, namespace, constant, or object declared in the above file can be used by the Qore program.

If such a program code (i.e. SomeClass.qc or SomeFuntion.ql) is a part of separated module (see Module Description) it will be included automatically.

The `QORE_INCLUDE_DIR` environment variable determines the search path for include files (see Environment Variables).