Recent

Author Topic: [SOLVED] Syntax error error in record declaration  (Read 917 times)

Codrut1001

  • New Member
  • *
  • Posts: 22
[SOLVED] Syntax error error in record declaration
« on: November 22, 2023, 03:04:18 pm »
I am porting some libraries from Embarcadero Delphi to Lazarus, but I get a error which I cannot understand:
Cod.Types.pas(38,9) Fatal: Syntax error, ":" expected but "identifier RECT" found

If I delete "public", I get this error:
Cod.Types.pas(47,9) Fatal: Syntax error, "END" expected but "FUNCTION" found

And If I delete public and the functions, the code compiles

Code: Pascal  [Select][+][-]
  1. TRoundRect = record
  2.       public
  3.         Rect: TRect;
  4.  
  5.         RoundTL,
  6.         RoundTR,
  7.         RoundBL,
  8.         RoundBR: integer;
  9.  
  10.         Corners: TCorners;
  11.  
  12.         function Left: integer;
  13.         function Right: integer;
  14.         function Top: integer;
  15.         function Bottom: integer;
  16.         function TopLeft: TPoint;
  17.         function BottomRight: TPoint;
  18.         function Height: integer;
  19.         function Width: integer;
  20.  
  21.         procedure Offset(const DX, DY: Integer);
  22.  
  23.         procedure SetRoundness(Value: integer);
  24.         function GetRoundness: integer;
  25.  
  26.         function RoundX: integer;
  27.         function RoundY: integer;
  28.  
  29.         constructor Create(TopLeft, BottomRight: TPoint; Rnd: integer); overload;
  30.         constructor Create(SRect: TRect; Rnd: integer); overload;
  31.         constructor Create(Left, Top, Right, Bottom: integer; Rnd: integer); overload;
  32.     end;  
  33.  

I feel like I'm missing something, but everything seems correct. Anyone has an idea?
« Last Edit: November 22, 2023, 03:17:03 pm by Codrut1001 »

Paolo

  • Hero Member
  • *****
  • Posts: 682
Re: Syntax error error in record declaration
« Reply #1 on: November 22, 2023, 03:13:18 pm »
To me it seems you missed {$modeSwitch advancedRecords}

dseligo

  • Hero Member
  • *****
  • Posts: 1674
Re: Syntax error error in record declaration
« Reply #2 on: November 22, 2023, 03:14:18 pm »
To me it seems you missed {$modeSwitch advancedRecords}

Or {$mode Delphi}

Codrut1001

  • New Member
  • *
  • Posts: 22
Re: Syntax error error in record declaration
« Reply #3 on: November 22, 2023, 03:16:49 pm »
To me it seems you missed {$modeSwitch advancedRecords}

Or {$mode Delphi}

That seems to be It.
Out of curiosity, why do I need to say the mode is Delphi, when I am programming in Lazarus Delphi?

Thanks!

Paolo

  • Hero Member
  • *****
  • Posts: 682
Re: [SOLVED] Syntax error error in record declaration
« Reply #4 on: November 22, 2023, 03:39:29 pm »
You are are programming in free pascal.
Mode delphi means that some constructs are as per delphi.

 

TinyPortal © 2005-2018