Recent

Author Topic: {$DEFINED ForEverybody} ?  (Read 3854 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3836
    • StrumPract is the musicians best friend
{$DEFINED ForEverybody} ?
« on: January 07, 2014, 01:02:15 pm »
Hello everybody.  ;)

Im searching for a way to do a compiler-define for all the project.

Let me try to explain :

I have a project that have in uses section  a other file:

Quote
Program MyProject;

uses
myincludes ;

In myincludes i have that:

Quote
{$DEFINE  ForEverybody}


Sadly, if, in MyProject i use that :
Quote
{$IFDEFINED  ForEverybody}
do_something
{ENDIF}

It does not work, because ForEverybody is not defined in MyProject    :-X

How must i do if i want that "ForEverybody" is defined also in MyProject (without to declare it in MyProject, of course)?

Many thanks.
« Last Edit: January 07, 2014, 01:04:52 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: {$DEFINED ForEverybody} ?
« Reply #1 on: January 07, 2014, 01:06:43 pm »
2 ways
1) use include files ee {$I MyDefines} which is equivalent to redeclaring the same defines in the units you use use the line.
2) use the project options dialog select the other and in custom options add -dForEverybody, this will create a define that is global for the project that is defined in, you might want to make a default if you are going to use it a lot.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Fred vS

  • Hero Member
  • *****
  • Posts: 3836
    • StrumPract is the musicians best friend
Re: {$DEFINED ForEverybody} ?
« Reply #2 on: January 07, 2014, 01:16:55 pm »
@ Taazz : many thanks  ;)

So, it is not possible to create a define for all the project via a file in uses section ?
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: {$DEFINED ForEverybody} ?
« Reply #3 on: January 07, 2014, 01:30:04 pm »
No, defines have only local scope.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12721
  • FPC developer.
Re: {$DEFINED ForEverybody} ?
« Reply #4 on: January 07, 2014, 01:30:54 pm »
Or put it on the cmdline (or lazarus "defines" settings)

Fred vS

  • Hero Member
  • *****
  • Posts: 3836
    • StrumPract is the musicians best friend
Re: {$DEFINED ForEverybody} ?
« Reply #5 on: January 07, 2014, 01:35:01 pm »
@ Taazz and Marcov : ok, many thanks.  ;)
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018