Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-09

Get LCL revision or version via ifdef

17 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

Hi,

I'm trying:

...
uses
LCLVersion,
{$IF (LCL_MAJOR = 0) AND (LCL_MINOR = 9) AND (LCL_RELEASE <= 30)} Classes,
{$ENDIF}
...

But:

"Error: Compile time expression: Wanted STRING but got BOOLEAN or INTEGER at "LCL_MAJOR = 0"".

How to I get the LCL version? (or revision)

Thx.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

silvioprog
to silvioprog

2011/9/30 silvioprog :

Show quoted text 20 lines
Hi, I'm trying: ... uses ?LCLVersion, {$IF (LCL_MAJOR = 0) AND (LCL_MINOR = 9) AND (LCL_RELEASE <= 30)} ?Classes, {$ENDIF} ... But: "Error: Compile time expression: Wanted STRING but got BOOLEAN or INTEGER at "LCL_MAJOR = 0"". How to I get the LCL version? (or revision) Thx.

In my lazsolutions.inc file, I'm trying:

{$IF ((LCL_MAJOR >= 0) and (LCL_MINOR >= 9) and (LCL_RELEASE >= 31))}
  {$DEFINE LSNEWLAZARUS}
{$ENDIF}

But:

">lazsolutions\trunk\Core\lazsolutions.inc(11,5) Error: Compile time expression: Wanted STRING but got BOOLEAN or INTEGER at "LCL_MAJOR >= 0""

How to I solve this?

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Sven Barth
to silvioprog
silvioprog wrote 36 lines
2011/9/30 silvioprog: > Hi, > > I'm trying: > > ... > uses > LCLVersion, > {$IF (LCL_MAJOR = 0) AND (LCL_MINOR = 9) AND (LCL_RELEASE<= 30)} > Classes, > {$ENDIF} > ... > > But: > > "Error: Compile time expression: Wanted STRING but got BOOLEAN or > INTEGER at "LCL_MAJOR = 0"". > > How to I get the LCL version? (or revision) > > Thx. In my lazsolutions.inc file, I'm trying: {$IF ((LCL_MAJOR>= 0) and (LCL_MINOR>= 9) and (LCL_RELEASE>= 31))} {$DEFINE LSNEWLAZARUS} {$ENDIF} But: ">lazsolutions\trunk\Core\lazsolutions.inc(11,5) Error: Compile time expression: Wanted STRING but got BOOLEAN or INTEGER at "LCL_MAJOR>= 0"" How to I solve this?

I personally don't see what's wrong there. Can you reproduce that with a small test program that does not depend on "LCLVersion", but defines the constants itself?

Also what version of FPC are you using?

Regards,
Sven

Reply by email

silvioprog
to Sven Barth

2011/10/1 Sven Barth :

I personally don't see what's wrong there. Can you reproduce that with a small test program that does not depend on "LCLVersion", but defines the constants itself?

Yes, in attached.

Also what version of FPC are you using?

Lazarus 0.9.30.2RC1 r32559 FPC 2.4.4 i386-win32-win32/win64.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -------------- next part -------------- A non-text attachment was scrubbed... Name: test.zip Type: application/zip Size: 2308 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111001/d79d2316/attachment.zip>

Reply by email

Sven Barth
to silvioprog
silvioprog wrote 6 lines
2011/10/1 Sven Barth: > I personally don't see what's wrong there. Can you reproduce that with a > small test program that does not depend on "LCLVersion", but defines the > constants itself? Yes, in attached.

Ahhha! I found your problem: You must define "{$mode objfpc}{$H+}" BEFORE the "interface"-section. It's a unit global switch and as such it must be defined before anything else (except other switches, comments and the "program/unit identifer;" declaration).

Regards,
Sven

Reply by email

silvioprog
to Sven Barth

2011/10/2 Sven Barth :

Show quoted text 7 lines
Ahhha! I found your problem: You must define "{$mode objfpc}{$H+}" BEFORE the "interface"-section. It's a unit global switch and as such it must be defined before anything else (except other switches, comments and the "program/unit identifer;" declaration). Regards, Sven

Hmm... how to I configure my .inc file for the demo work?

(new demo in attached)

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -------------- next part -------------- A non-text attachment was scrubbed... Name: test2.zip Type: application/zip Size: 1491 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111002/ffa0e5a1/attachment.zip>

Reply by email

Marcos Douglas
to silvioprog

2011/10/2 silvioprog

Show quoted text 13 lines
2011/10/2 Sven Barth : > Ahhha! I found your problem: You must define "{$mode objfpc}{$H+}" BEFORE > the "interface"-section. It's a unit global switch and as such it must be > defined before anything else (except other switches, comments and the > "program/unit identifer;" declaration). > > Regards, > Sven Hmm... how to I configure my .inc file for the demo work? (new demo in attached)

Simple, just use .inc in unit files. Do not put logical in .lpr files.

Marcos Douglas

Reply by email

silvioprog
to Marcos Douglas

2011/10/2 Marcos Douglas :

Simple, just use .inc in unit files. Do not put logical in .lpr files. Marcos Douglas

Did not work. x(

See demo in attached.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -------------- next part -------------- A non-text attachment was scrubbed... Name: test3.zip Type: application/zip Size: 1543 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111002/203d0553/attachment.zip>

Reply by email

Marcos Douglas
to silvioprog

2011/10/2 silvioprog :

Show quoted text 8 lines
2011/10/2 Marcos Douglas : > Simple, just use .inc in unit files. Do not put logical in .lpr files. > > Marcos Douglas Did not work. x( See demo in attached.

Sorry, I understood.

The LCLVersion unit contains constants, see:
const
  lcl_major = 0;
  lcl_minor = 9;
  lcl_release = 31;
  lcl_patch = 0;
  lcl_fullversion = ((lcl_major *  100 + lcl_minor) * 100 +
lcl_release) * 100 + lcl_patch;
  lcl_version = '0.9.31';

So, just use them.

See http://www.lazarus.freepascal.org/index.php?topic=7453.0

Marcos Douglas

Reply by email

silvioprog
to Marcos Douglas

2011/10/2 Marcos Douglas :

Show quoted text 18 lines
Sorry, I understood. The LCLVersion unit contains constants, see: const ?lcl_major = 0; ?lcl_minor = 9; ?lcl_release = 31; ?lcl_patch = 0; ?lcl_fullversion = ((lcl_major * ?100 + lcl_minor) * 100 + lcl_release) * 100 + lcl_patch; ?lcl_version = '0.9.31'; So, just use them. See http://www.lazarus.freepascal.org/index.php?topic=7453.0 Marcos Douglas

I don't found the solution in the link above. :/ If I understand it, the solution would be to use macros?

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Marcos Douglas
to silvioprog
silvioprog wrote 22 lines
2011/10/2 Marcos Douglas : > > Sorry, I understood. > > The LCLVersion unit contains constants, see: > const > ?lcl_major = 0; > ?lcl_minor = 9; > ?lcl_release = 31; > ?lcl_patch = 0; > ?lcl_fullversion = ((lcl_major * ?100 + lcl_minor) * 100 + > lcl_release) * 100 + lcl_patch; > ?lcl_version = '0.9.31'; > > So, just use them. > > See http://www.lazarus.freepascal.org/index.php?topic=7453.0 > > Marcos Douglas I don't found the solution in the link above. :/ If I understand it, the solution would be to use macros?

The solution is use constants above.
I don't see using macros here.

Marcos Douglas

Reply by email

Alexsander Rosa
to silvioprog: 2011/10/2 Marcos Douglas : I don't found the solution in the link above. :/ If I…
uses LCLVersion;
Edit1.Text := lcl_version + '.' + IntToStr(lcl_patch);

2011/10/4 silvioprog

Show quoted text 42 lines
2011/10/2 Marcos Douglas : > > Sorry, I understood. > > The LCLVersion unit contains constants, see: > const > lcl_major = 0; > lcl_minor = 9; > lcl_release = 31; > lcl_patch = 0; > lcl_fullversion = ((lcl_major * 100 + lcl_minor) * 100 + > lcl_release) * 100 + lcl_patch; > lcl_version = '0.9.31'; > > So, just use them. > > See http://www.lazarus.freepascal.org/index.php?topic=7453.0 > > Marcos Douglas I don't found the solution in the link above. :/ If I understand it, the solution would be to use macros? -- Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== * Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Atenciosamente, Alexsander da Rosa http://rednaxel.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111004/d8a2b0e4/attachment.html>

Reply by email

silvioprog
to Alexsander Rosa

2011/10/4 Alexsander Rosa :

uses LCLVersion; Edit1.Text := lcl_version + '.' + IntToStr(lcl_patch);

I'm needing to use in the uses clause, as I showed in my first example. But in the uses clause the FPC is not accepting the compilation.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

cobines
to silvioprog

2011/10/4 silvioprog :

I'm needing to use in the uses clause, as I showed in my first example. But in the uses clause the FPC is not accepting the compilation.

I think it is not possible as it seems the constants are not declared while in the interface uses section. You can use it in the uses implementation section. Checked with FPC trunk too.

unit test2;
{$mode objfpc}{$H+}
interface
uses
  LCLVersion
  {$IF DECLARED(lcl_fullversion)}
  {$ERROR interface}
  {$ENDIF}
  ;
implementation
  {$IF DECLARED(lcl_fullversion)}
  {$ERROR implementation}
  {$ENDIF}
begin
end.

$ fpc test2.pas
Free Pascal Compiler version 2.7.1 [2011/09/09] for i386 Copyright (c) 1993-2011 by Florian Klaempfl and others Target OS: Win32 for i386
Compiling test2.pas
test2.pas(17,4) Error: User defined: implementation

cobines

Reply by email

silvioprog
to cobines

2011/10/4 cobines :

Show quoted text 37 lines
2011/10/4 silvioprog : > I'm needing to use in the uses clause, as I showed in my first > example. But in the uses clause the FPC is not accepting the > compilation. I think it is not possible as it seems the constants are not declared while in the interface uses section. You can use it in the uses implementation section. Checked with FPC trunk too. unit test2; {$mode objfpc}{$H+} interface uses ?LCLVersion ?{$IF DECLARED(lcl_fullversion)} ?{$ERROR interface} ?{$ENDIF} ?; implementation ?{$IF DECLARED(lcl_fullversion)} ?{$ERROR implementation} ?{$ENDIF} begin end. $ fpc test2.pas Free Pascal Compiler version 2.7.1 [2011/09/09] for i386 Copyright (c) 1993-2011 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling test2.pas test2.pas(17,4) Error: User defined: implementation -- cobines

I solved my problem using a manual definition(*), without use the LCLVersion.

Thanks to all.

(*) http://code.google.com/p/lazsolutions/source/browse/trunk/Core/lazsolutions.inc
Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Hans-Peter Diettrich
to cobines: 2011/10/4 silvioprog : I think it is not possible as it seems the constants are not…
Show quoted text 18 lines
2011/10/4 silvioprog : > I'm needing to use in the uses clause, as I showed in my first > example. But in the uses clause the FPC is not accepting the > compilation. I think it is not possible as it seems the constants are not declared while in the interface uses section. You can use it in the uses implementation section. Checked with FPC trunk too. unit test2; {$mode objfpc}{$H+} interface uses LCLVersion {$IF DECLARED(lcl_fullversion)} {$ERROR interface} {$ENDIF} ;

Perhaps the used unit is not parsed until a separator token (',' or ';') has been parsed. What if you try:

uses LCLVersion

,

{$IF DECLARED(lcl_fullversion)} {$ERROR interface} {$ENDIF}

SysUtils

;

DoDi

Reply by email

cobines
to Hans-Peter Diettrich

2011/10/5 Hans-Peter Diettrich :

Show quoted text 11 lines
Perhaps the used unit is not parsed until a separator token (',' or ';') ?has been parsed. What if you try: > uses > ? LCLVersion ? ?, > ? {$IF DECLARED(lcl_fullversion)} > ? {$ERROR interface} > ? {$ENDIF} ? ?SysUtils > ? ;

Still the same. If moved after ';' it gives "Internal error 200501152".

cobines

Reply by email