RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2095: Missing ENDIF directive (Delphi)

This error message is issued if the compiler does not find a corresponding $ENDIF directive after an $IFDEF, $IFNDEF or $IFOPT directive.

program Produce;
(*$APPTYPE CONSOLE*)
begin
(*$IfOpt O+*)
  Writeln('Compiled with optimizations');
(*$Else*)
  Writeln('Compiled without optimizations');
(*Endif*)
end.                                           (*<-- Error message here*)

In this example, we left out the $ character in the (*$Endif*) directive, so the compiler mistook it for a comment.

program Solve;
(*$APPTYPE CONSOLE*)
begin
(*$IfOpt O+*)
  Writeln('Compiled with optimizations');
(*$Else*)
  Writeln('Compiled without optimizations');
(*$Endif*)
end.

The solution is to make sure all the conditional directives have a valid $ENDIF directive.

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