View Issue Details

IDProjectCategoryView StatusLast Update
0034858FPCCompilerpublic2021-04-23 11:25
Reporteruser5570Assigned ToJonas Maebe  
Status resolvedResolutionfixed 
Fixed in Version3.3.1 
Summary0034858: Conditional compilations fails: {$ifdef} {$elseif} {$endif}
  {$ERROR Unknown endian}

Documentation state this should be correct syntax:

However, error: "ENDIF without IF(N)DEF" is shown due compilation on line with $ELSEIF.
Steps To ReproduceCreate new app and place upper code anywhere and try to compile.
TagsNo tags attached.
Fixed in Revision41724
Attached Files


related to 0038793 resolvedJonas Maebe $IF DEFINED(xxx) <> $IFDEF xxx when using $ELSEIF DEFINED(xxx) 


Serge Anvarov

2019-01-13 08:37

reporter   ~0113370

As far as I understand, the documentation says {$ELSEIF ...} can only be applied to {$IF ...}, not the {$IFDEF ...} you are using.


2019-01-13 09:12


Thank you Sergey,

I assume can be used defined() with $IF, however Delphi have supported $IFDEF with $ELSEIF and $IFEND (instead $ENDIF), which is definitely simpler and clearer. FPC seems do not support it, yet.

J. Gareth Moreton

2019-01-13 15:39

developer   ~0113382

I can confirm that $ELSEIF belongs to the $IF and $IFEND family. If you want to build something akin to what you specified, you need to write the following:

{$ELSE} // Adding ENDIAN_LITTLE afterwards is optional
    {$ERROR Unknown endian}

Alternatively, you can do:

{$IF defined(ENDIAN_LITTLE)}
  {$ERROR Unknown endian}

Regardless, the documentation and the Delphi support you mention may need to be evaluated.

Thaddy de Koning

2021-04-23 11:25

reporter   ~0130539

{$ifend} is also supported by FreePascal.
It gets muddy since the strict synatx was abandoned.

Issue History

Date Modified Username Field Change
2019-01-13 03:54 user5570 New Issue
2019-01-13 08:37 Serge Anvarov Note Added: 0113370
2019-01-13 09:12 user5570 Note Added: 0113371
2019-01-13 10:01 Michael Van Canneyt Project Lazarus => FPC
2019-01-13 15:39 J. Gareth Moreton Note Added: 0113382
2019-03-16 21:38 Jonas Maebe Fixed in Revision => 34858
2019-03-16 21:38 Jonas Maebe Status new => resolved
2019-03-16 21:38 Jonas Maebe Fixed in Version => 3.3.1
2019-03-16 21:38 Jonas Maebe Resolution open => fixed
2019-03-16 21:38 Jonas Maebe Assigned To => Jonas Maebe
2019-03-17 15:21 Jonas Maebe Fixed in Revision 34858 => 41724
2019-03-17 15:21 Jonas Maebe Product Version 2.0RC3 =>
2019-03-17 15:21 Jonas Maebe Description Updated View Revisions
2021-04-23 11:05 Jonas Maebe Relationship added related to 0038793
2021-04-23 11:25 Thaddy de Koning Note Added: 0130539