Missing conditional windows compiling switches. lazarus / 6-IDE-CodeTools ---------------------------------------------------------------------- KodeZwerg · 2022-11-24 18:05 Since my thread over here https://forum.lazarus.freepascal.org/index.p hp?topic=61335.msg461190#msg461190 was not successful I would have a suggestion to make for upcoming releases of Lazarus IDE. Please do add in the .lpr file a proper way for Windows based applications. A console application need {$APPTYPE CONSOLE} (and a GUI application can have {$APPTYPE GUI}) Of course it shall have checks like {$IFDEF MSWINDOWS} etc.... Thanks in advance! ---------------------------------------------------------------------- KodeZwerg · 2022-11-24 18:15 Quote from: hi friends on November 24, 2022, 07:10:02 pmHi friend. I tried to understand but don't understand what the hell you're talking about. Please help friend.  Since we are in the suggestions forum, there is no need for you to understand. ---------------------------------------------------------------------- KodeZwerg · 2022-11-24 18:40 Quote from: hi friends on November 24, 2022, 07:30:45 pmHere he have an exemplar of the species Boomer Aeternus. Right, you're directing this to the top dogs only, not me, not anyone else. Sorry friend. I apology for my rude answer, without that conditional switch a console application will having a bad end. I hope that is answer enough. ---------------------------------------------------------------------- Bart · 2022-11-24 20:24 You can set it in compiler options. Uncheck Win32 GUI application in "Config and Target". Bart ---------------------------------------------------------------------- KodeZwerg · 2022-11-24 20:30 Quote from: Bart on November 24, 2022, 09:24:36 pmYou can set it in compiler options. Uncheck Win32 GUI application in "Config and Target". Bart It does not add the needed line, on image i show options, i confirmed them, re-opened options to make snapshot. ---------------------------------------------------------------------- KodeZwerg · 2022-11-24 20:34 Quote from: Bart on November 24, 2022, 09:24:36 pmYou can set it in compiler options. Uncheck Win32 GUI application in "Config and Target". Bart Ahhh but it stop getting me the error 103 message and keeps console up. Why does that config not getting applied when I select "simple application" from "Create new project" ---------------------------------------------------------------------- PascalDragon · 2022-11-24 21:00 Quote from: KodeZwerg on November 24, 2022, 07:05:50 pmA console application need {$APPTYPE CONSOLE} (and a GUI application can have {$APPTYPE GUI}) Of course it shall have checks like {$IFDEF MSWINDOWS} etc.... The $apptype directive is not only for Windows. And the compiler will only warn about it on platforms that don't support it. So I don't really see a use for this. ---------------------------------------------------------------------- Bart · 2022-11-24 21:12 IIRC Delphi7 dislikes ifdef's around {$apptype} directive. Bart ---------------------------------------------------------------------- Bart · 2022-11-24 21:15 Quote from: KodeZwerg on November 24, 2022, 09:34:27 pmWhy does that config not getting applied when I select "simple application" from "Create new project" Not sure. In the not so long past I did a feature request for a "default compiler setting" per project type. That would solve this problem. Unfortunately I have no idea how to implement something like this myself, the IDE is way to complex for me. Bart ---------------------------------------------------------------------- tetrastes · 2022-11-24 21:18 Quote from: KodeZwerg on November 24, 2022, 07:05:50 pmA console application need {$APPTYPE CONSOLE} Quote from: KodeZwerg on November 24, 2022, 07:40:29 pmwithout that conditional switch a console application will having a bad end Why do you think so? From https://www.freepascal.org/docs- html/current/prog/progsu86.html#x94-930001.3.3 QuoteCONSOLE A console application. A terminal will be created and standard input, output and standard error file descriptors will be initialized. In Windows, a terminal window will be created. This is the default. When creating project for GUI (Application) Lazarus simply adds -WG (Win32 GUI application) option to project options. So there is no need in {$APPTYPE ...}. Quote from: KodeZwerg on November 24, 2022, 09:34:27 pmQuote from: Bart on November 24, 2022, 09:24:36 pmYou can set it in compiler options. Uncheck Win32 GUI application in "Config and Target". Bart Ahhh but it stop getting me the error 103 message and keeps console up. Why does that config not getting applied when I select "simple application" from "Create new project" What do you mean? Lazarus doesn't add -WG when creating projects for console programs. ---------------------------------------------------------------------- Bart · 2022-11-24 21:26 Quote from: tetrastes on November 24, 2022, 10:18:52 pmWhat do you mean? Lazarus doesn't add -WG when creating projects for console programs. The default compiler setting on Windows is to have -WG set for all project types. (I.o.w. the "Win32 GUI application" checkbox is checked by default in Co,piler Options->Config and Target) Bart ---------------------------------------------------------------------- KodeZwerg · 2022-11-24 21:29 When I not deactivate that -WG switch or when I do not have {$APPTYPE CONSOLE} in the .lpr file, the attachment show what happen on a Windows machine, that is the reason of why I would like to have such per default set. ---------------------------------------------------------------------- tetrastes · 2022-11-24 22:45 Quote from: Bart on November 24, 2022, 10:26:38 pmQuote from: tetrastes on November 24, 2022, 10:18:52 pmWhat do you mean? Lazarus doesn't add -WG when creating projects for console programs. The default compiler setting on Windows is to have -WG set for all project types. (I.o.w. the "Win32 GUI application" checkbox is checked by default in Co,piler Options->Config and Target) Bart No, unless you check "Set compiler options as default" when "Win32 GUI application" is checked (and press "OK" button, of course). Moreover, if you do this when "Win32 GUI application" is unchecked, projects for GUI Applications will be created without -WG. At least this is so at my Lazarus 2.2.4. You can verify this by looking in Lazarus config folder (C:\Users\...\AppData\Local\Lazarus by default) for file projectoptions.xml. If it is there, delete it, and see how different projects are created. ---------------------------------------------------------------------- KodeZwerg · 2022-11-24 23:07 Quote from: PascalDragon on November 24, 2022, 10:00:27 pmQuote from: KodeZwerg on November 24, 2022, 07:05:50 pmA console application need {$APPTYPE CONSOLE} (and a GUI application can have {$APPTYPE GUI}) Of course it shall have checks like {$IFDEF MSWINDOWS} etc.... The $apptype directive is not only for Windows. And the compiler will only warn about it on platforms that don't support it. So I don't really see a use for this. In my thinking I more like to get a warning instead of no console appear at all when you not uncheck -WG or having the conditional active. But okay (since you helped me on my other thread to fix that issue on my own I can live with it even if I am unsure if that be the correct behave of an IDE that should support the user) ---------------------------------------------------------------------- Bart · 2022-11-25 14:05 Quote from: tetrastes on November 24, 2022, 11:45:48 pmNo, unless you check "Set compiler options as default" when "Win32 GUI application" is checked (and press "OK" button, of course). That may very well be the case, since I saved and use default compiler options (with debug and release versions). Bart