Recent

Author Topic: problem with assigning values to a record  (Read 3195 times)

noob

  • New member
  • *
  • Posts: 5
problem with assigning values to a record
« 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?

bigeno

  • Full Member
  • ***
  • Posts: 247
Re: problem with assigning values to a record
« Reply #1 on: May 14, 2014, 08:05:47 am »
Press Ctrl and click on "point". What unit will open ?

noob

  • New member
  • *
  • Posts: 5
Re: problem with assigning values to a record
« Reply #2 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;

noob

  • New member
  • *
  • Posts: 5
Re: problem with assigning values to a record
« Reply #3 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

Leledumbo

  • Hero Member
  • *****
  • Posts: 8114
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: problem with assigning values to a record
« Reply #4 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.