#pragma
#include <stdio.h>
#define DEBUG 1
The following table lists the preprocessor directives and gives a brief description of each.
Directive |
Description |
define |
Defines a preprocessor macro or constant. |
undef |
Deletes a preprocessor macro or constant definition. |
include |
Reads source text from an external file. The notation sequence determines the search sequence of the included files. C51 searches for include files specified with less-than/greater-than symbols (< >) in the include file directory. C51 searches for include files specified with double-quotes (" ") in the current directory. |
if |
Evaluates an expression for conditional compilation. |
ifdef |
Evaluates an expression for conditional compilation. The argument to be evaluated is the name of a definition. |
ifndef |
Same as ifdef but the evaluation succeeds if the definition is not defined. |
elif |
Initiates an alternative branch of the if condition, when the previous if, ifdef, ifndef, or elif branch was not taken. |
else |
Initiates an alternative branch when the previous if, ifdef, or ifndef branch was not taken. |
line |
Specifies a line number together with an optional filename. These specifications are used in error messages to identify the error position. |
endif |
Ends an if, ifdef, ifndef, elif, or else block. |
error |
Outputs an error message defined by the user. This directive instructs the compiler to emit the specified error message. |
pragma |
Allows you to specify control directives that may also be setup in the project compiler options window. |