RAD Studio (Common)
x1030: Invalid compiler directive: '%s' (Delphi)

This error message means there is an error in a compiler directive or in a command line option. Here are some possible error situations:

  • An external declaration was syntactically incorrect.
  • A command line option or an option in a DCC32.CFG file was not recognized by the compiler or was invalid. For example, '-$M100' is invalid because the minimum stack size must be at least 1024.
  • The compiler found a $XXXXX directive, but could not recognize it. It was probably misspelled.
  • The compiler found a $ELSE or $ENDIF directive, but no preceding $IFDEF, $IFNDEF or $IFOPT directive.
  • (*$IFOPT*) was not followed by a switch option and a + or -.
  • The long form of a switch directive was not followed by ON or OFF.
  • A directive taking a numeric parameter was not followed by a valid number.
  • The $DESCRIPTION directive was not followed by a string.
  • The $APPTYPE directive was not followed by CONSOLE or GUI.
  • The $ENUMSIZE directive (short form $Z) was not followed by 1,2 or 4.

(*$Description Copyright CodeGear 2007*)    (*<-- Error here*)
program Produce;
(*$AppType Console*)                                     (*<-- Error here*)

(*$If O+*)                                               (*<-- Error here*)
Writeln('Optimizations are ON');
(*$Else*)                                                (*<-- Error here*)
Writeln('Optimizations are OFF');
(*$Endif*)                                               (*<-- Error here*)
Writeln('Hello world!');

The example shows three typical error situations, and the last two errors are caused by the compiler not having recognized $If.

(*$Description 'Copyright CodeGear 2007'*)  (*Need string*)
program Solve;
(*$AppType Console*)                                     (*AppType*)

(*$IfOpt O+*)                                            (*IfOpt*)
  Writeln('Optimizations are ON');
(*$Else*)                                                (*Now fine*)
  Writeln('Optimizations are OFF');
(*$Endif*)                                               (*Now fine*)
  Writeln('Hello world!');

So $Description needs a quoted string, we need to spell $AppType right, and checking options is done with $IfOpt. With these changes, the example compiles fine.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!