Lazarus
Free Pascal => General => Topic started 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.
-
{$ifndef console}
-
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
-
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
-
{$ifndef console}
Please note that this will only work in the main project file or if all units are recompiled.