Recent

Author Topic: What is wrong with this conditional expression? {$IF }[SOLVED]  (Read 349 times)

OH1KH

  • Jr. Member
  • **
  • Posts: 90
When looking for example I found this one from this Forum:

It's not really the Lazarus version. After all, Lazarus is just an IDE, i.e. an overgrown text-editor. ;) What really matters is the version of the LCL and you can get that with LCL_FULLVERSION. For example:

Code: Pascal  [Select][+][-]
  1.   {$IF (LCL_FULLVERSION < 1080400)}
  2.   ShowMessage('I''ll use workarounds for Lazarus pre-1.8.4');
  3.   {$ELSE}
  4.   Showmessage('Woah! Congrats! Lazarus is at least 1.8.4.0!')
  5.   {$ENDIF}

Based on this I made similar:
Code: Pascal  [Select][+][-]
  1. var
  2. {$IF (LCL_FULLVERSION >= 4060000)}
  3.    handle : TLCLHandle;
  4. {$ELSE}
  5.     handle : THandle;   //deprecated on Laz 4.6
  6. {$ENDIF}
  7.   dmData : TdmData;          
  8.  

When I compile I get errors pointing to this $IF..$ELSE..$ENDIF now added source:
                 
Compile Project, Target: /home/saku/lazarus/CqrlogAlpha/src/cqrlog: Exit code 1, Errors: 2, Warnings: 1
dData.pas(365,5) Error: Incompatible types: got "AnsiString" expected "Int64"
dData.pas(365,5) Error: Compile time expression: Wanted Boolean but got <erroneous type> at IF or ELSEIF
dData.pas(368,21) Warning: Symbol "THandle" is deprecated: "Use TLCLHandle instead of this redefined THandle"

All Googling gives just similar examples.
What is the problem that I can not see?
« Last Edit: April 16, 2026, 04:33:20 pm by OH1KH »
--
Saku

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1946
Re: What is wrong with this conditional expression? {$IF }
« Reply #1 on: April 16, 2026, 03:23:01 pm »
Code: Pascal  [Select][+][-]
  1. uses LCLVersion;

OH1KH

  • Jr. Member
  • **
  • Posts: 90
Re: What is wrong with this conditional expression? {$IF }[SOLVED]
« Reply #2 on: April 16, 2026, 04:32:48 pm »
Yes, I am blind !

Added that, but to another unit where I needed it too.
Forgot to add it also here.

Many thanks !
--
Saku

 

TinyPortal © 2005-2018