Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-03

"Function header doesn't match" error

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

I wonder whether anybody could throw some light on a curious error. I've just tried to move a class definition into the interface part of a unit, so that I could easily add a class helper, but I'm getting an error

borgumserverinterface.pas(927,24) Error: (3048) function header doesn't match any method of this class
"TzzConnection.ExecuteSQL2(TStringList,Boolean="FALSE"):Boolean;"

If I move the class back into the implementation part there's no error. Simplified code as below:

interface
uses
   Classes, SysUtils, StrUtils, BorgUMFingerD, BorgUMCode, sqldb;
type
         TzzConnection= class(TObject)
..
           public
..
             function ExecuteSQL2(sl: TStringList;
                 relaxInuseCheck: boolean= false): boolean;
..
implementation
uses pqconnection, ibconnection, Custom, postgres3dyn, ibase60dyn, Regexpr;
..
function TzzConnection.ExecuteSQL2(sl: TStringList; relaxInuseCheck:
boolean= false): boolean;
..

It's that final declaration that goes wrong, but I can fix it by moving the class back into the implementation part. FPC 2.6.2 on Linux x86.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Ewald
to Mark Morgan Lloyd

Once upon a time, Mark Morgan Lloyd said:

Show quoted text 40 lines
I wonder whether anybody could throw some light on a curious error. I've just tried to move a class definition into the interface part of a unit, so that I could easily add a class helper, but I'm getting an error borgumserverinterface.pas(927,24) Error: (3048) function header doesn't match any method of this class "TzzConnection.ExecuteSQL2(TStringList,Boolean="FALSE"):Boolean;" If I move the class back into the implementation part there's no error. Simplified code as below: interface uses Classes, SysUtils, StrUtils, BorgUMFingerD, BorgUMCode, sqldb; type TzzConnection= class(TObject) .. public .. function ExecuteSQL2(sl: TStringList; relaxInuseCheck: boolean= false): boolean; .. implementation uses pqconnection, ibconnection, Custom, postgres3dyn, ibase60dyn, Regexpr; .. function TzzConnection.ExecuteSQL2(sl: TStringList; relaxInuseCheck: boolean= false): boolean; .. It's that final declaration that goes wrong, but I can fix it by moving the class back into the implementation part. FPC 2.6.2 on Linux x86.

Just and idea: Can it be that you redefined TStringList (or boolean for that matter, but that doesn't strike me as obvious) in oneof the units you used in your implementation section?

Ewald

Reply by email

Flávio Etrusco
to Mark Morgan Lloyd: I wonder whether anybody could throw some light on a curious error. I've just tried to…
Mark Morgan Lloyd wrote 40 lines
I wonder whether anybody could throw some light on a curious error. I've just tried to move a class definition into the interface part of a unit, so that I could easily add a class helper, but I'm getting an error borgumserverinterface.pas(927,24) Error: (3048) function header doesn't match any method of this class "TzzConnection.ExecuteSQL2(TStringList,Boolean="FALSE"):Boolean;" If I move the class back into the implementation part there's no error. Simplified code as below: interface uses Classes, SysUtils, StrUtils, BorgUMFingerD, BorgUMCode, sqldb; type TzzConnection= class(TObject) .. public .. function ExecuteSQL2(sl: TStringList; relaxInuseCheck: boolean= false): boolean; .. implementation uses pqconnection, ibconnection, Custom, postgres3dyn, ibase60dyn, Regexpr; .. function TzzConnection.ExecuteSQL2(sl: TStringList; relaxInuseCheck: boolean= false): boolean; .. It's that final declaration that goes wrong, but I can fix it by moving the class back into the implementation part. FPC 2.6.2 on Linux x86. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk

The simplified code also fails? Removing the default parameter value from the implementation makes any difference?

-Flávio

Reply by email

Mark Morgan Lloyd
to Flávio Etrusco
Flávio Etrusco wrote 8 lines
On Sun, Mar 31, 2013 at 7:36 AM, Mark Morgan Lloyd wrote: > I wonder whether anybody could throw some light on a curious error. I've > just tried to move a class definition into the interface part of a unit, so > that I could easily add a class helper, but I'm getting an error The simplified code also fails? Removing the default parameter value from the implementation makes any difference?

Ewald got it right: I'd defined myself a custom TStringList for reasons that seemed sensible at the time.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to Ewald: Once upon a time, Mark Morgan Lloyd said: Just and idea: Can it be that you redefined…
Ewald wrote 20 lines
Once upon a time, Mark Morgan Lloyd said: > I wonder whether anybody could throw some light on a curious error. > I've just tried to move a class definition into the interface part of > a unit, so that I could easily add a class helper, but I'm getting an > error > > borgumserverinterface.pas(927,24) Error: (3048) function header > doesn't match any method of this class > "TzzConnection.ExecuteSQL2(TStringList,Boolean="FALSE"):Boolean;" > > If I move the class back into the implementation part there's no > error. Simplified code as below: > It's that final declaration that goes wrong, but I can fix it by > moving the class back into the implementation part. FPC 2.6.2 on Linux > x86. > Just and idea: Can it be that you redefined TStringList (or boolean for that matter, but that doesn't strike me as obvious) in oneof the units you used in your implementation section?

I haven't... I'm sure I wouldn't be that stupid... oh bother.

Guilty as charged. I'd defined Custom.TStringList with a non-standard Append2 method which appended a fragment to the last line. It builds if I convert that to a class helper, but I haven't tested yet.

Thanks for your help and everybody's patience.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email