Difference between revisions of "Preprocessor Defines"

From ROBOTC API Guide
Jump to: navigation, search
Line 6: Line 6:
 
|The ROBOTC Compiler supports several different preprocessor defines that contain information about the compile time environment. Recently added are defines that indicate which features are enabled in the IDE.
 
|The ROBOTC Compiler supports several different preprocessor defines that contain information about the compile time environment. Recently added are defines that indicate which features are enabled in the IDE.
  
The predefined symbols can be used in include files ad user programs for conditionally compiling code based on features. The preprocessor defines include:
+
The predefined symbols can be used in include files and user programs for conditionally compiling code based on features. The preprocessor defines include:
 
   {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:center; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000;" cellpadding="5%"
 
   {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:center; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000;" cellpadding="5%"
 
   ! style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|''Symbol Name''
 
   ! style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|''Symbol Name''

Revision as of 14:47, 20 June 2012

General Programming → Preprocessor Defines


The ROBOTC Compiler supports several different preprocessor defines that contain information about the compile time environment. Recently added are defines that indicate which features are enabled in the IDE.

The predefined symbols can be used in include files and user programs for conditionally compiling code based on features. The preprocessor defines include:

Symbol Name Usage / Comments
ROBOTC Indicates that the ROBOTC compiler was used.
_DEBUG, _RELEASE, _CUSTOM Compiler optimization selection.
_TARGET Contains the type of debugger target. One of the following

values: “Robot”, “Emulator” or “VirtWorld”.

NXT, TETRIX, VEX, VEX20, ARDUINO The currently selected platform.
firmwareVersion Contains the numerical firmware version; e.g. 852.
IFI When IFI platform is selected.
TETRIX When TETRIX features are active.
FTC When FTC features are active.
Algebra When robot algebra option is enabled.
MultiRobotSupport When multi-robot option is enabled.


ROBOTC also supports the standard C preprocessor symbols below:

Symbol Name Usage / Comments
__FILE__ Current filename.
__LINE__ Current line number.
__DATE__ Date “mmm dd yyyy” of the current compilation.
__TIME__ Time “hh:mm:ss” of the current compilation.