Recent

Author Topic: Error : Error: function header doesn't match any method of this class  (Read 4527 times)

Neuromancer

  • New Member
  • *
  • Posts: 38
    • My personal website
Hello,

I wrote the following class :
Code: [Select]
TGame = class sealed
{...}
function FindNeighbours(AX : Integer; AY : Integer) : TPointArray;
end;

{...}
implementation

function TGame.FindNeighbours(AX : Integer; AY : Integer) : TPointArray;
var
i : integer;
begin

end;

When I am trying to compile I get the following error :
Quote
Error: function header doesn't match any method of this class "TGame.FindNeighbours(LongInt,LongInt):Dynamic Array Of TPoint;"

Could you help me ?

Blaazen

  • Hero Member
  • *****
  • Posts: 3034
  • POKE 54296,15
    • Eye-Candy Controls
Your code works well for me. I tested in FPC trunk, mode objfpc and delphi.
Lazarus 2.1.0 r64546 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7034
  • Debugger - SynEdit - and more
    • wiki
Maybe you have some "uses" in the implementation section?

If so, then maybe one of those used units defines "TPointArray" (or less likely "integer").

That would mean, that even it has the same name (and maybe even the same textual declaration), it may be a distinct type.

FTurtle

  • Sr. Member
  • ****
  • Posts: 289
I think the cause of trouble is: in interface and implementation uses different declarations of some type(s) (most possible TPointArray). Move mouse cursor over them and see declarations.
Solution: move all system modules from uses in implementation to uses in interface

Neuromancer

  • New Member
  • *
  • Posts: 38
    • My personal website
I think the cause of trouble is: in interface and implementation uses different declarations of some type(s) (most possible TPointArray). Move mouse cursor over them and see declarations.
Solution: move all system modules from uses in implementation to uses in interface
Yes, you are right. Thankyou !

 

TinyPortal © 2005-2018