Lazarus

Free Pascal => General => Topic started by: 440bx on August 30, 2018, 12:44:24 pm

Title: can defines be made global ?
Post by: 440bx on August 30, 2018, 12:44:24 pm
Hello,

when defining a symbol, e.g, {$define somesymbol} the definition remains valid in the unit.

Is it possible to have a {$define somesymbol} that defines "somesymbol"  in all the units used by the program without having to re-{$define somesymbol} in every unit ?

Thank you.
Title: Re: can defines be made global ?
Post by: taazz on August 30, 2018, 12:45:28 pm
only if you use a defines.inc file and included in your units.
Title: Re: can defines be made global ?
Post by: Bart on August 30, 2018, 12:50:46 pm
Compile with -dSomesymbol

Bart
Title: Re: can defines be made global ?
Post by: 440bx on August 30, 2018, 12:57:50 pm
Compile with -dSomesymbol

Bart

Thank you Taazz and thank you Bart.  Bart, I will take your answer. (geez..  I should have thought about that...)
Title: Re: can defines be made global ?
Post by: marcov on August 30, 2018, 01:24:10 pm
Compile with -dSomesymbol

Do a build-all with -dsomesymbol.
Title: Re: can defines be made global ?
Post by: 440bx on August 30, 2018, 02:15:48 pm
Compile with -dSomesymbol

Do a build-all with -dsomesymbol.

Indeed, build, to ensure the defined symbol applies to the entire program.  Thank you Marco.
Title: Re: can defines be made global ?
Post by: JuhaManninen on August 30, 2018, 02:19:51 pm
Do a build-all with -dsomesymbol.
The Project Options -> Compiler Options -> Custom Options pane in Lazarus has a nice GUI for defines. It remembers the earlier used ones.
A build-all is done automatically after compiler options change.
Title: Re: can defines be made global ?
Post by: 440bx on August 30, 2018, 02:28:43 pm
Do a build-all with -dsomesymbol.
The Project Options -> Compiler Options -> Custom Options pane in Lazarus has a nice GUI for defines. It remembers the earlier used ones.
A build-all is done automatically after compiler options change.
Yes, it does and, I used that to put my defines in there. :)