2

Free Pascal 2.6.2 编译器(使用 Delphi 模式)抱怨

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.

带有此错误消息:

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

我用

  inherited Create (CreateSuspended);  

这似乎是由 2.6.2 中的更改引起的,TThread 现在有一个带有可选第二个参数的构造函数声明:

 constructor Create(CreateSuspended: Boolean;
                    const StackSize: SizeUInt = DefaultStackSize);   
4

1 回答 1

3

inherited;调用基类构造函数Create(CreateSuspended: Boolean)。由于基类没有采用一个布尔参数的构造函数,因此您遇到了错误。

于 2013-05-07T11:00:59.553 回答