Lazarus

Free Pascal => Beginners => Topic started by: noob on May 14, 2014, 07:53:46 am

Title: problem with assigning values to a record
Post by: noob on May 14, 2014, 07:53:46 am
hi,

this problem puzzles me, i can't compile my program - please help.

the declaration and the mode
Code: [Select]
{$mode objfpc}{$H+}
point5: ARRAY[0..4] OF Tpoint;

i try ti assign some values to a point:
Code: [Select]
point5[0] := point(xm, ym);
andd it fails with
xygrph30\xygraph3d.pas(2086,26) Fatal: Syntax error, ")" expected but "," found

what am i doing wrong?
Title: Re: problem with assigning values to a record
Post by: bigeno on May 14, 2014, 08:05:47 am
Press Ctrl and click on "point". What unit will open ?
Title: Re: problem with assigning values to a record
Post by: noob on May 14, 2014, 08:10:26 am
struct.inc opens at:

Code: [Select]
     POINT = record
          x : LONG;
          y : LONG;
       end;
     LPPOINT = ^POINT;
     tagPOINT = POINT;
     TPOINT = POINT;
     PPOINT = ^POINT;
Title: Re: problem with assigning values to a record
Post by: noob on May 14, 2014, 08:16:51 am
thank you for this hint. i found the problem.
if i use Windows as the first include in the USE statement the error is GONE!!

thank you very much
Title: Re: problem with assigning values to a record
Post by: Leledumbo on May 17, 2014, 07:05:22 am
Both Windows and Classes (and also Types) unit declare Point identifier, but for different purpose. In Windows, it's a record data type. In Classes/Types, it's a function returning TPoint record. Read the docs about relationship of identifier searching and unit order in uses clause.
TinyPortal © 2005-2018