Skip to content

Error: Unbound custom attribute: "TMyAttribute".

Hi,

I'm getting error Error: Unbound custom attribute: "TMyAttribute". when compiling this code:

program project2;

{$mode Delphi}

uses
  Classes,
  SysUtils;

type
  TMyAttribute = class(TCustomAttribute)
  public
    constructor Create(const Name: string);
  end;

type
  TMyRecord = record
    Field: string;
  end;

type
  TMyClass = class
  private
    fTest: TMyRecord;
  public
    [TMyAttribute('Test')]
    property Test: TMyRecord read fTest write fTest;
  end;

{ TMyAttribute }

constructor TMyAttribute.Create(const Name: string);
begin
//
end;

begin
  try
    { TODO -oUser -cConsole Main : Insert code here }
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

It compiles well under Delphi!

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information