Keil Logo

DEFINE Compiler Directive




One or more names (in accordance with the naming conventions of the C language) separated by commas. An optional value may be assigned to each name.




Options — C51 — Define.


The DEFINE directive defines preprocessor symbols on the compiler command line. This is equivalent to using the #define directive in your program source code. You may use the #if, #ifdef, and #ifndef preprocessor directives to query names defined with the DEFINE directive.

Defined names are copied exactly as they are entered and are case-sensitive. Each name may be assigned a value.


  • The DEFINE directive may be specified only on the command line. Use the C preprocessor #define directive to define symbols inside a C source file.
  • The DEFINE directive may not be used to define preprocessor macros.
C51 SAMPLE.C DEFINE (check, NoExtRam)

C51 MYPROG.C DF (X1='1+5',iofunc='getkey ()')
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.