Question

The Free Pascal 2.6.2 compiler (using Delphi mode) complained about

program project16416258;

{$mode Delphi}

uses
  Classes;

type
  TFPCTestThread = class(TThread)
  public
    constructor Create(CreateSuspended: Boolean);
  end;

constructor TFPCTestThread.Create(CreateSuspended: Boolean);
begin
  inherited;
end;

begin
end.

with this error message:

ThroughputTestUnit.pas(82,19) Error: Wrong number of parameters
specified for call to "Create" Hint: Found declaration: constructor
TThread.Create(Boolean,const LongWord="4194304");

I fixed it using

  inherited Create (CreateSuspended);  

It seems to be caused by a change in 2.6.2, TThread has a constructor declaration with an optional second argument now:

 constructor Create(CreateSuspended: Boolean;
                    const StackSize: SizeUInt = DefaultStackSize);   
Was it helpful?

Solution

inherited; calls base class constructor Create(CreateSuspended: Boolean). Since base class has no constructor which takes one boolean argument, you've got your error.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top