Recent

Author Topic: [SOLVED] {$IFDEF} issue  (Read 1332 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1289
[SOLVED] {$IFDEF} issue
« on: January 24, 2018, 09:04:54 am »
Hi, I'm trying to make two Lazarus projects, except one thing: one project uses firebird and another TBufDataSet. So,

program MyProgram               uses firebird,
program MyProgram_demo    uses bufdataset.   And I defined DEMO in the project options.

In a few units, there are optional compilation, e.g.

{$IFDEF DEMO}
do something with BufDataSet;
{$ELSE}
do something with FireBird;
{$END}

This conditional compilation works fine, if run first time on Lazarus (let's say MyProgram).

But then, if I open another project (i.e. MyProgram_demo), still the previous one (MyProgram) is executed, even though the source editor shows correct "greying" of codes.  But if I see the execution of code by pressing F7/F8, wrong codes (previous one, i.e. "greyed" codes) are executed.

This happens even though I terminate Lazarus, and restart. That is, I first run MyProgram, open MyProgram_demo, then terminate Lazarus, restart Lazarus, and then run MyProgram_demo, but MyProgram is executed.

This disappears
   1) if I terminate Lazarus,
   2) then execute other program (like webbrowser) at the same PC,
   3) and then restart Lazarus.


Please check this, and advise me.

Regards,
« Last Edit: January 24, 2018, 09:20:41 am by egsuh »

Handoko

  • Hero Member
  • *****
  • Posts: 5149
  • My goal: build my own game engine using Lazarus
Re: {$IFDEF} issue
« Reply #1 on: January 24, 2018, 09:17:07 am »
Maybe you need to rebuild (instead of simply running) the program every time you switch the mode:
Lazarus main menu > Run > Build

egsuh

  • Hero Member
  • *****
  • Posts: 1289
Re: {$IFDEF} issue
« Reply #2 on: January 24, 2018, 09:20:26 am »
Oh yes.  "Build" works. Thank you very much.

 

TinyPortal © 2005-2018