$ENDIF without $IFDEF is not allowed

The compiler directive $ENDIF is used to close a block opened with $IFDEF. Since $IFDEF has not been used yet (or its block has already been closed), $ENDIF is not allowed here. Here is an example of how compiler directives might be used correctly:

$define Test
$ifdef Test
  title = "My Formula (test version)"
$else
  title = "My Formula"
$endif

See Also
Errors