Lazarus

Free Pascal => General => Topic started by: simone on March 11, 2019, 08:57:59 pm

Title: Predefined constant for GUI applications
Post by: simone on March 11, 2019, 08:57:59 pm
In order to conditionally compile some piece of code with FPC, is there a predefined constant that lets to discriminate if the source is a GUI program, i.e. is compiled with -WG option? Thanks in advance.
Title: Re: Predefined constant for GUI applications
Post by: marcov on March 11, 2019, 09:04:11 pm
{$ifndef console}
Title: Re: Predefined constant for GUI applications
Post by: simone on March 11, 2019, 10:16:33 pm
Very simple! I did not know this symbol because is not present on the official list:

https://www.freepascal.org/docs-html/current/prog/progap7.html#x333-349000G

Title: Re: Predefined constant for GUI applications
Post by: Thausand on March 12, 2019, 06:59:13 am
hello,

You write not official list is console but is written in other part here https://www.freepascal.org/docs-html/prog/progse3.html#progsu86.html

It writes "Global directives" and for console you watch part AppType here https://www.freepascal.org/docs-html/prog/progsu86.html#x94-930001.3.3

There it writes "console" and more.

so is official  :D
Title: Re: Predefined constant for GUI applications
Post by: PascalDragon on March 12, 2019, 09:01:59 am
{$ifndef console}
Please note that this will only work in the main project file or if all units are recompiled.
TinyPortal © 2005-2018