Frage

I want to use OmniThreadLibrary in a project I am working on Delphi XE2, I've followed the instructions.

  • Add OTL folder and OTL/src to Delphi's Library Path.
  • Build both project in Delphi XE2 package and install.

The instructions are pretty simple and the OmniEventMonitor is in the palette.

However, I can not run a single one of the examples.

For example, when i try to run:

procedure TForm2.Button1Click(Sender: TObject);
begin

  Button1.Enabled := false;

  Parallel.Async(
    procedure
    begin
      // executed in background thread
      Sleep(500);
      MessageBeep($FFFFFFFF);
    end,

    Parallel.TaskConfig.OnTerminated(
      procedure (const task: IOmniTaskControl)
      begin
      // executed in main thread
      btnAsync.Enabled := true;
    end
    )
  );
end;

I get the error Undeclared Identifier Parallel.

Did I do something wrong during the installation?

War es hilfreich?

Lösung

The error message is:

Undeclared Identifier Parallel.

Parallel is a class (containing class methods) declared in the OtlParallel unit. Which means that if the compiler cannot see the Parallel class, then you have not added OtlParallel to your uses clause.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top