错误:未声明的标识符'TMyClass'

时间:2014-03-05 17:04:39

标签: delphi

我正在使用embarcadero DataSnap中的代码练习。 实现以下代码时,我收到错误消息: 错误:第42行未声明的标识符“TMyClass” 我很确定周围存在错误:   PersistentClass:= TMyClass;

感谢任何帮助。

 unit MyServer;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IPPeerServer, Datasnap.DSCommonServer,
  Datasnap.DSTCPServerTransport, Datasnap.DSServer;

type
  TForm1 = class(TForm)
    DSServer1: TDSServer;
    DSServerClass1: TDSServerClass;
    DSTCPServerTransport1: TDSTCPServerTransport;
    procedure DSServerClass1GetClass(DSServerClass: TDSServerClass;
      var PersistentClass: TPersistentClass);
    procedure DSServerClass1CreateInstance(
      DSCreateInstanceEventObject: TDSCreateInstanceEventObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.DSServerClass1CreateInstance(
  DSCreateInstanceEventObject: TDSCreateInstanceEventObject);
begin

end;

procedure TForm1.DSServerClass1GetClass(DSServerClass: TDSServerClass;
  var PersistentClass: TPersistentClass);
begin

      PersistentClass := TMyClass;
end;

end.

1 个答案:

答案 0 :(得分:1)

错误很明显。在使用TMyClass时,编译器无法看到具有该名称的符号。

大多数人都没有声明它,或者在uses子句中省略了声明它的单位。