$Include
 
Metacommand statement to include contents of another source file

Syntax

'$Include [once]: 'file'
or
Rem $Include [once]: 'file'

Description

$Include inserts source code from another file at the point where the $Include metacommand appears. This has the effect of compiling the source code from the include file as though it were part of the source file that includes it. Once the compiler has reached the end of the include file, the original source file continues to be compiled.

The once specifier tells the compiler to include the file only once even if it is included several times by the source code.

'$Include: exists for compatibility with QuickBASIC. It is recommended to use #include instead.

Example

' header.bi file
Type FooType
    Bar As Byte
    Barbeque As Byte 
End Type
Dim Foo As FooType


'' compile with -lang fblite or qb

#lang "fblite"

'' main.bas file

'$INCLUDE: "header.bi"

Foo.Bar = 1
Foo.Barbeque = 2

Dialect Differences

Differences from QB

  • None

See also