Lazarus

Programming => Widgetset => QT => Topic started by: Fred vS on July 28, 2011, 11:11:50 pm

Title: [SOLVED] {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: Fred vS on July 28, 2011, 11:11:50 pm
Hello everybody.  ;)
Does it exists something like :

Code: [Select]
{$IFDEF Qt}
  procedureQt();
           {$ENDIF} 
{$IFDEF GTK}
  procedureGTK();
           {$ENDIF} 

So the compiler do different things for each Qt or GTK compil ?

Thanks
Title: Re: {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: Blaazen on July 28, 2011, 11:49:05 pm
Yes, correct is:

Code: [Select]
{$IFDEF LCLQt}
  procedureQt();
{$ENDIF} 
{$IFDEF LCLGTK}
  procedureGTK();
{$ENDIF} 

http://wiki.lazarus.freepascal.org/Code_Conversion_Guide#Useful_compiler_variables_.2F_defines_.2F_macros (http://wiki.lazarus.freepascal.org/Code_Conversion_Guide#Useful_compiler_variables_.2F_defines_.2F_macros)
Title: Re: {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: Fred vS on July 29, 2011, 12:34:17 am
Mr Blaazen, you are really the best.  :-[

Many thanks

Title: Re: [SOLVED] {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: Fred vS on July 29, 2011, 12:40:42 am
Hum and if i want :

{$IFDEF LCLQt} or {$IFDEF Darwin} ?
(what is the compiler-syntax for 'or' and 'and'  :-[)
Title: Re: [SOLVED] {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: Fred vS on July 29, 2011, 01:14:47 am
I try that and it seems that the compiler like it ...

Quote
{$ifdef Darwin or ifdev LCLQt}

 ::)
Title: Re: [SOLVED] {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: Fred vS on July 29, 2011, 01:27:39 am
Quote
{$ifdef Darwin or ifdev LCLQt}

Do not what i want  :'(
Title: Re: [SOLVED] {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: Blaazen on July 29, 2011, 01:31:22 am
Correct is:
Code: [Select]
{$IF DEFINED(DARWIN) or DEFINED(LCLQt)}
Title: Re: [SOLVED] {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: Fred vS on July 29, 2011, 01:40:24 am
Well done Mr Blaazen  :P
Title: Re: [SOLVED] {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: clauslack on January 27, 2012, 11:00:56 pm
Hello, with this code
Code: [Select]
{$IFDEF LCLQt}
  ShowMessage('qt');
{$ENDIF} 
{$IFDEF LCLGTK2}
  ShowMessage('gtk2');
{$ENDIF} 
Work fine with IDE,

but when compile the project with lazbuild
Ej: lazbuild --ws=qt project.lpi
 show gtk2

if compile with IDE on QT, then
lazbuild --ws=qt project.lpi
show qt

if delete tmp subdir lib and compile
lazbuild --ws=qt project.lpi
show gtk2

I'm going crazy

Somebody can test with lazbuild?

Tested with Lazarus 0.9.30.1 fpc 2.4.2/2.4.4 Linux 32 and 64 bits.

Thanks

Title: Re: [SOLVED] {$IFDEF Qt} and {$IFDEF GTK} ?
Post by: clauslack on January 29, 2012, 01:08:04 am
I found the problem
if I compile with IDE project1.lpi with GTK2
then
lazbuild --ws=qt project1.lpi
this always show GTK2, because lazbuild reuse *.o  files.

I must use
lazbuild --build-all --ws=qt project1.lpi
this erase *.o files and recompile the units.
For me, is an lazbuild error.

Regards