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);