$INCLUDE directive

Purpose:

$INCLUDE merges a file into the calling BCX file at translation time. $INCLUDE can be used anywhere in a program and the file will be inserted at the position of the $INCLUDE directive.

Syntax 1:

$INCLUDE "Path\Filename"

Parameters:

  • Data type: STRING
    "Path\Filename" The path\directory to search for the file to be included.

Example:

$INCLUDE"C:\bcx\include\file.bas"

Syntax 2:

$INCLUDE "Filename"

Parameters:

  • Data type: STRING
    "Filename" will instruct the BCX translator to search in the current working directory for the file to be included.

Example:

$INCLUDE "file.bas"


Syntax 3:

$INCLUDE <Filename>

Parameters:

Example:

$INCLUDE <file.bas>

Remarks:

BCX $INCLUDE files can be nested. This means that a file called with $INCLUDE can call other files to included.

👉 Each $INCLUDE directive must be on its own line in the source code file, for example, the following is not allowed:

$INCLUDE "File1.inc" : $INCLUDE "File2.inc" 

Below is the only acceptable form:

$INCLUDE "File1.inc"   ' Comments are allowed
$INCLUDE "File2.inc"   ' As many as you want ...

#INCLUDE directive

Purpose:

#INCLUDE merges a C language header file into the translated C source at compile time. You may add #INCLUDE statements anywhere in your BASIC source code. BCX watches for these and adds them to the top of the generated C file along with the other header files.

Syntax 1:

#INCLUDE "Path\Filename"

Parameters:

  • Data type: STRING
    "Path\Filename" The path\directory to search for the file to be included.

Syntax 2:

#INCLUDE "Filename"

Parameters:

  • Data type: STRING
    "Filename" will instruct the compiler to search in the current working directory for the file to be included.

Example:

#INCLUDE "c_header.h";

Syntax 3:

#INCLUDE <Filename>

Parameters:

  • Data type: STRING
    <Filename> will instruct the compiler to search in the default include directory of the C compiler for the file to be included.

Example:

#INCLUDE <c_header.h>