Recent

Author Topic: [SOLVED] code executable as expected but grayed out in editor  (Read 812 times)

kegge13

  • New Member
  • *
  • Posts: 45
    • the BistroMath project
[SOLVED] code executable as expected but grayed out in editor
« on: October 23, 2020, 05:55:06 pm »
In my project-compiler-options include file this construc can be found:
{$DEFINE SelfTest}
{$IFOPT D-}
  {$UNDEF SelfTest}
{$ENDIF}
                       
So if not in debug mode, do not include selftest. This works fine, but still that part of the code is grayed out (LCL 2.0.10 on Windows) in debug mode. See small screen dump. I can set breakpoints in this code, introduce compiler errors etc.

Any suggestions?
Thanks in advance.
« Last Edit: October 24, 2020, 11:56:08 am by kegge13 »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: code executable as expected but grayed out in editor
« Reply #1 on: October 23, 2020, 06:41:53 pm »
My guess, based on a quick test, is that the IDE is not parsing correctly the IFOPT directive and instead assumes "D-" as default, as shown in the attached image.

The most probable reason might be because it's a compiler directive and its default is, IIRC, that state (don't generate debugging info).
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

kegge13

  • New Member
  • *
  • Posts: 45
    • the BistroMath project
[SOLVED] code executable as expected but grayed out in editor
« Reply #2 on: October 24, 2020, 11:55:38 am »
Thanks for pointing in the right direction.
I found this earlier topic: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Conditional-define-via-Build-mode-td3638027.html
and followd that line: add -dDEBUG as compiler option for debug mode.

Then I can check on that:
{$DEFINE SelfTest}
{$IFNDEF DEBUG}
  {$UNDEF SelfTest}
{$ENDIF}

Now my code looks (and works) as expected in both modes.

 

TinyPortal © 2005-2018