#include " filename"

#include <filename>


This statement directs the pre-processor to copy the contents of filename into the source to be compiled by the BASIC compiler.  After that file is copied, the compilation continues on with the next statement in the original program. 

These statements may nest, as one file can include another which can include another...  

When filename is enclosed in "  ", the directory of the main BASIC program is searched.  The filename may contain a relative path, and remember that path is always relative to the directory of the main BASIC program.

When the filename is enclosed in < >, the Program Files/Coridium/BASIClib directory is searched.

Normally #include statements are near the beginning of the BASIC program so that FUNCTIONs and SUBs can be defined before their first use.  When this is the case a MAIN: should be used so that code does not try to execute the FUNCTION or SUB code inline.


'  include the module that controls VDRIVE

#include "Vdrive.bas"

'  compiler picks up here

Differences from other BASICs

  • no equivalent in PBASIC
  • no equivalent in Visual BASIC, but may be done with C-pre-processor
See also