Recent

Author Topic: Compile error with forms  (Read 1730 times)

dietmar

  • Full Member
  • ***
  • Posts: 170
Compile error with forms
« on: September 26, 2021, 07:01:49 pm »
Hi,

on my main form, the following is working (f is a TForm):
f.BoundsRect := Rect(0,0,ClientWidth, ClientHeight);

on all other forms, this line results in the compile error
"Syntax error, ")" expected but "," found"

It seems that the compiler expects "Rect(0)"...

I searched through my source code - no "Rect" function, variable or whatever found.
What is going wrong here?

Thx,
--Dietmar
Lazarus 2.2.0RC1 with FPC 3.2.2 (32 Bit) on Windows10 (64Bit)

jamie

  • Hero Member
  • *****
  • Posts: 4915
Re: Compile error with forms
« Reply #1 on: September 26, 2021, 08:31:41 pm »
You have another identifier of that name with different type nearer in scope references.

rest your cursor on the identifier and allow for Code tools to display the source of it.
The only true wisdom is knowing you know nothing

Thaddy

  • Hero Member
  • *****
  • Posts: 10929
Re: Compile error with forms
« Reply #2 on: September 26, 2021, 08:36:21 pm »
At least on Windows, there are two rect() definitions. One in the Windows unit.
Try changing unit order.
The average programmer productivity is 4-5 hours per day. Peak performance 72 hours for short bursts. MTBF is 1 second or less.

dietmar

  • Full Member
  • ***
  • Posts: 170
Re: Compile error with forms
« Reply #3 on: September 26, 2021, 08:56:05 pm »
Jep, that made it... thx a lot!

--Dietmar
Lazarus 2.2.0RC1 with FPC 3.2.2 (32 Bit) on Windows10 (64Bit)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
  • Former Delphi 1-7, 10.2 user
Re: Compile error with forms
« Reply #4 on: September 27, 2021, 01:35:02 am »
Jep, that made it... thx a lot!

Which solution did you use - jamie or Thaddy?
Lazarus 2.3 + FPC 3.3.1 2021-10-19 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 + FPC 3.3.1 2021-09-21 macOS 11.6 aarch64 Xcode 13
Lazarus 2.3 2021-08-11 FPC 3.2.2 FreeBSD 13.0 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

dietmar

  • Full Member
  • ***
  • Posts: 170
Re: Compile error with forms
« Reply #5 on: October 01, 2021, 08:15:18 pm »
To be honest: The solution of Thaddy was absolutely sufficient ;)

--Dietmar
Lazarus 2.2.0RC1 with FPC 3.2.2 (32 Bit) on Windows10 (64Bit)

 

TinyPortal © 2005-2018