Including Files in Your Program

You use include to include the contents of another file in your program during compilation. The syntax is:

    include "OSFileName"

The OSFileName can include a path name, but you must remember that the backslash character used to give subdirectories in the DOS-related versions of Visual Prolog is an escape character in Visual Prolog. Because of this, you must always give two backslash characters when you use the backslash in a path inside the source text.

    include "ˇ¬ˇ¬vipˇ¬ˇ¬includeˇ¬ˇ¬error.con"

Under Options | Project | Directories you can give one or more paths separated by semicolons (colons under UNIX) to indicate where the Prolog system should look for the include files (Here, of course, only a single backslash is required). If you don't give an absolute path in your OSFileName, the compiler will in turn try to concatenate each of the paths given in the include directory to your filename in order to locate the file.

You can only use include files on section boundaries in a program, so include can appear only where one of the keywords domains, predicates, goal, database, or clauses is permitted. An include file itself can contain further include directives. However, include files must not be used recursively in such a way that the same file is included more than once during compilation.

Include files can contain any sections, provided the restrictions on program structure are observed (see page 243).