Set conditional Defines for a project lazarus / 11-Options ---------------------------------------------------------------------- hy · 2008-03-08 14:35 Hi I need to set conditional defines for a whole project.how can this be done? How can I determine whether a project is just a command-line/Terminal- program or if it is a graphical app? onetime I need to output messages via messageDLG('Error',mtinformation,[mbok],0) and another time it just reads: writeln('Error...'); Thanks in advance ---------------------------------------------------------------------- OnixJr · 2008-03-08 15:24 QuoteHow can I determine whether a project is just a command- line/Terminal-program or if it is a graphical app? Try use directive {$APPTYPE CONSOLE} to set as "command- line/Terminal/program" and remove and/or comment directive {$mode objfpc}... Thanks! ---------------------------------------------------------------------- hy · 2008-03-08 16:19 And how can I check this? Any compiler directive used in the *.lpr as {$DEFINE CommandlineMode} is not seen in the units used by the programm. i need to distinguish between a Directive being set and not set. and as far as I know there is no way of checking {$ifdef AppType=CONSOLE} Thanks ---------------------------------------------------------------------- Phil · 2008-03-08 16:59 Quote from: "hy"i need to distinguish between a Directive being set and not set. and as far as I know there is no way of checking {$ifdef AppType=CONSOLE} Delphi and Free Pascal both have variables like IsLibrary and IsConsole that can be checked at runtime. However, before you do that, review what it is you're trying to do. I think you're going at it the wrong way. To use MessageDlg, your uses clause will be different than in a console app that uses WriteLn, so use the same IFDEF logic in your code as you do in your uses clause. Thanks. -Phil ---------------------------------------------------------------------- hy · 2008-03-08 17:24 Hi  Phil, I am pretty sure I know what I am doing. I'm on Pascal Code for more than 20 years now - and not just as a hobby. But as a hobby I am porting my Delphi-s7uff 2 Lazarus at the moment. Okay, admittedly there might be some (very few) design flaws in my Library, but the least thing I want to  do at the moment is redesigning the whole thing. I want to know how far I can get with it using Lazarus. Generally it runs well with win and Linux - except for some strange behaviour  - when compiled as an application. The same code doesn't compile when included in a console-programm - which is strange, because the same units are included.