Recent

Author Topic: Peculiar LCL $IFDEF issue...?  (Read 746 times)

Sieben

  • Sr. Member
  • ****
  • Posts: 310
Peculiar LCL $IFDEF issue...?
« on: December 28, 2020, 09:45:24 pm »
I made a somewhat puzzling observation last night as already described here. When I place

Code: Pascal  [Select][+][-]
  1.       {$IFDEF LCLGTK2}
  2.       dudeldum
  3.       {$ENDIF}

somewhere in an 'original' LCL unit like eg StdCtrls.pp or customcombobox.inc the 'code' between is not grayed out but obviously is nevertheless ignored by the compiler. I am on Gtk2 here and target is Gtk2 as well. When I replace LCLGTK2 with LCLQT or LCLWIN32 the code is grayed out as expected. Other defines as eg {$IFDEF UNIX} work as expected as well. When I place above quirk in project code or source of one of my own packages the compiler does stop at dudeldum as expected. Tested twice with both stable and trunk and FPC 3.2.0.

How is that...?
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Peculiar LCL $IFDEF issue...?
« Reply #1 on: December 28, 2020, 10:07:26 pm »
Sounds like the modified unit isn't the one being compiled.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Sieben

  • Sr. Member
  • ****
  • Posts: 310
Re: Peculiar LCL $IFDEF issue...?
« Reply #2 on: December 28, 2020, 10:29:49 pm »
No, modified unit is definitely compiled, changes in code outside above clause are reflected and syntax errors are not ignored either.
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: Peculiar LCL $IFDEF issue...?
« Reply #3 on: December 28, 2020, 11:27:12 pm »
I have run into that already before..

Code tools can see it but the compiler can not.

Code tools looks at things in your project that aren't seen in the compiler..

you need to either use a define the compiler understands or include that define in the Custom-Options as a define the compiler can see.

after that, the fpc should parse that correctly.

In my case, I simply switched to using a Windows Check instead of a interface check.
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018