Recent

Author Topic: Error: invalid mode switch "FUNCTIONREFERENCES"  (Read 991 times)

RDL

  • Jr. Member
  • **
  • Posts: 72
Error: invalid mode switch "FUNCTIONREFERENCES"
« on: May 10, 2023, 10:50:29 am »
Hi.

Lazarus 2.2.6 (install from fpcupdeluxe)
FPC 3.3.1 Trunk
Win10 x64

I create a simple project and I get an error

Sorry for my english, google translation!

Warfley

  • Hero Member
  • *****
  • Posts: 2031
Re: Error: invalid mode switch "FUNCTIONREFERENCES"
« Reply #1 on: May 10, 2023, 10:54:30 am »
As this is a Codetools error looks like your fpc version has features you Lazarus version does not support

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12563
  • FPC developer.
Re: Error: invalid mode switch "FUNCTIONREFERENCES"
« Reply #2 on: May 10, 2023, 11:21:04 am »
(afaik those are anonymous methods related, which are from last year may/june)

PascalDragon

  • Hero Member
  • *****
  • Posts: 6235
  • Compiler Developer
Re: Error: invalid mode switch "FUNCTIONREFERENCES"
« Reply #3 on: May 10, 2023, 10:26:01 pm »
Lazarus 2.2.6 (install from fpcupdeluxe)
FPC 3.3.1 Trunk
Win10 x64

I create a simple project and I get an error

Lazarus 2.2.6 does not support the FunctionReferences modeswitch introduced in FPC 3.3.1. As long as you don't recompile the 3.3.1 code you can go to the Classes unit and change the code from

Code: Pascal  [Select][+][-]
  1. {$IF FPC_FULLVERSION>=30301}
  2. {$modeswitch FUNCTIONREFERENCES}
  3. {$define FPC_HAS_REFERENCE_PROCEDURE}
  4. {$endif}

to

Code: Pascal  [Select][+][-]
  1. {$IF FPC_FULLVERSION>=30301}
  2. {.$modeswitch FUNCTIONREFERENCES}
  3. {.$define FPC_HAS_REFERENCE_PROCEDURE}
  4. {$endif}

Alternatively you can follow the comment near the top of the Rtti unit and declare a define InLazIDE that's only valid from within the IDE and then surround the code in the Classes unit like this:

Code: Pascal  [Select][+][-]
  1. {$IF FPC_FULLVERSION>=30301}
  2. {$ifndef InLazIDE}
  3. {$modeswitch FUNCTIONREFERENCES}
  4. {$define FPC_HAS_REFERENCE_PROCEDURE}
  5. {$endif}
  6. {$endif}

RDL

  • Jr. Member
  • **
  • Posts: 72
Re: Error: invalid mode switch "FUNCTIONREFERENCES"
« Reply #4 on: May 11, 2023, 02:08:38 am »
Thank you.  :)
Used this option
Code: Pascal  [Select][+][-]
  1. {$IF FPC_FULLVERSION>=30301}
  2. {.$modeswitch FUNCTIONREFERENCES}
  3. {.$define FPC_HAS_REFERENCE_PROCEDURE}
  4. {$endif}
  5.  
Sorry for my english, google translation!

 

TinyPortal © 2005-2018