Delphi:缺少运算符或分号

标签 delphi operator-keyword

我正在使用 Indy 10(TIdTcpServer),但出现以下错误:

[DCC Error] MainForm.pas(88): E2066 Missing operator or semicolon

尝试运行这段代码时:

procedure TForm1.SendMessage(Data: String; Client: Integer);
var
  List: TList;
  AContext: TIdContext;
begin
  List := idTcpServer1.Contexts.LockList;
  AContext(List[0]).Connection.IOHandler.WriteLn(Data);  // Line 88
end;

我不知道我错过了什么;有帮助吗?

最佳答案

虽然我无法解释您遇到的错误,但您的代码完全错误。

将其更改为:

procedure TForm1.SendMessage(Data: String; Client: Integer);
var
  List: TList;
  AContext: TIdContext;
begin
  List := idTcpServer1.Contexts.LockList;
  AContext := TIdContext(List[0]);
  AContext.Connection.IOHandler.WriteLn(Data);
end;

您对非类型类型转换的错误使用可能会使编译器感到困惑。如果这不能解决问题,请编辑您的问题以围绕您发布的内容添加更多代码(您发布的内容之前的十几行会有所帮助)。

关于Delphi:缺少运算符或分号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12611855/

相关文章:

delphi - 重载函数时不接受数组类型参数

delphi - 托管局部变量是否可以透明地 "travel to"另一个局部范围?

C++嵌套条件运算符循环

C++ 模板与 operator< 不匹配

powershell - Powershell:具有转义参数(-%)的调用运算符(&)无法与非静态参数一起使用

c++ - 将表示为链表的两个大数相乘

c++ - Borland BCB5 TInifile 使用 Readstring() 忽略引号?

forms - 为什么不建议在运行时更改表单样式?

html - 如何告诉 Outlook 图像文件在哪里?

c++ - 重载 C++ == 运算符