Sign in Join

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

Mailing lists / fpc-pascal / 2013-05

How to use string defines ?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Geoffray Levasseur-Brandin

Hi everybody,

I'm trying to make an application that need to be FHS compliant. For that I want be abble to pass some strings as compile time parameters (eg. the famous $PREFIX). I tryed this :

// installation paths defines
{$if undefined(PREFIX)}
	{$DEFINE PREFIX:='/usr/local'}
{$endif}
{$if undefined(BINDIR)}
	{$DEFINE BINDIR:=(PREFIX) + '/bin'}
{$endif}
{$if undefined(SYSCONFDIR)}
	{$DEFINE SYSCONFDIR:=(PREFIX) + '/etc'}
{$endif}
{$if undefined(LOCALSTATEDIR)}
	{$DEFINE LOCALSTATEDIR=(PREFIX) + '/var'}
{$endif}

But I havec those errors :
defines.inc(68,5) Error: Compile time expression: Wanted BOOLEAN but got STRING at IF or ELSEIF
defines.inc(71,5) Error: Compile time expression: Wanted BOOLEAN but got STRING at IF or ELSEIF
defines.inc(74,5) Error: Compile time expression: Wanted BOOLEAN but got STRING at IF or ELSEIF
defines.inc(77,5) Error: Compile time expression: Wanted BOOLEAN but got STRING at IF or ELSEIF

The fact is that I have no idea on how to create and use that kind of defines and I didn't find something about.

Thank you for any help !

Geoffray « Fatalerrors » Levasseur-Brandin http://jeff.levasseur.tuxfamily.org/ http://0.tuxfamily.org/ GNU/PG key : BF8BB8407CD26E89466CDA9BB1030FC59EF87775 Errare humanum est sed perseverare diabolicum aut cretinum.
patspiper
to Geoffray Levasseur-Brandin

Turn macros on
http://www.freepascal.org/docs-html/prog/progse4.html

Stephano

Geoffray Levasseur-Brandin wrote 39 lines
Hi everybody, I'm trying to make an application that need to be FHS compliant. For that I want be abble to pass some strings as compile time parameters (eg. the famous $PREFIX). I tryed this : // installation paths defines {$if undefined(PREFIX)} {$DEFINE PREFIX:='/usr/local'} {$endif} {$if undefined(BINDIR)} {$DEFINE BINDIR:=(PREFIX) + '/bin'} {$endif} {$if undefined(SYSCONFDIR)} {$DEFINE SYSCONFDIR:=(PREFIX) + '/etc'} {$endif} {$if undefined(LOCALSTATEDIR)} {$DEFINE LOCALSTATEDIR=(PREFIX) + '/var'} {$endif} But I havec those errors : defines.inc(68,5) Error: Compile time expression: Wanted BOOLEAN but got STRING at IF or ELSEIF defines.inc(71,5) Error: Compile time expression: Wanted BOOLEAN but got STRING at IF or ELSEIF defines.inc(74,5) Error: Compile time expression: Wanted BOOLEAN but got STRING at IF or ELSEIF defines.inc(77,5) Error: Compile time expression: Wanted BOOLEAN but got STRING at IF or ELSEIF The fact is that I have no idea on how to create and use that kind of defines and I didn't find something about. Thank you for any help ! _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal