Delphi 5迁移-找不到文件
我正在将我的Delphi 5应用程序迁移到Delphi XE3。我对XE3完全陌生 编译应用程序时,我收到错误“未声明的标识符交互信息” 代码如下所示: abc公司:Delphi 5迁移-找不到文件,delphi,delphi-xe3,Delphi,Delphi Xe3,我正在将我的Delphi 5应用程序迁移到Delphi XE3。我对XE3完全陌生 编译应用程序时,我收到错误“未声明的标识符交互信息” 代码如下所示: abc公司: Interace_Info = packed record iflag: ulong; end; 其中,在“abc.inc”文件中声明了Interace_信息 我无法通过按Ctrl+鼠标左键打开“使用”部分中提到的任何文件。我收到错误“找不到文件‘winapi.unit2.pas’” 解决这个问题的办法是什么 谢谢你的评论,
Interace_Info = packed record
iflag: ulong;
end;
其中,在“abc.inc”文件中声明了Interace_信息
我无法通过按Ctrl+鼠标左键打开“使用”部分中提到的任何文件。我收到错误“找不到文件‘winapi.unit2.pas’”
解决这个问题的办法是什么
谢谢你的评论,你的代码不可能是真正的代码 我正在发布这个,我现在用Delphi XE3编译它,没有任何问题 档案:abc.inc
type
Interace_Info = packed record
iflag: ulong;
end;
文件:Unit2.pas
unit Unit2;
interface
uses winapi.Windows;
{$include abc.inc}
implementation
end.
文件:Unit1.pas
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
type
TLocal = array[0..10] of Interace_Info;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
ALocal: TLocal;
begin
ALocal[0].iflag := 0;
ShowMessage(IntToStr(ALocal[0].iflag));
end;
end.
它编译和运行没有任何问题。修复
unit2
以实际包含代码,并删除{$Include abc.inc}
行,然后修复unit2
uses子句以删除WinAPI
,由于对16位Windows程序的支持消失,它已经过时。继续使用.inc文件是完全有效的。它的内容将与包含它的.pas文件合并。abc.inc的内容实际上是什么样子的?更改是它没有正确声明接口\ u信息
,因此它没有被编译到User2的.dcu文件中供Unit1使用。看起来unit2中缺少接口和实现声明。@JachGrate,我们只能猜测,代码很可能不是真实的代码。ULONG是在winApi.windows中声明的。我在你的代码中没有看到任何对这个单元的引用。也没有任何接口/实现声明。请显示真实代码。ulong:Dword在unit2.pas中声明。无法复制代码,因为代码位于远程计算机上。很抱歉。谢谢您的回答,但是应用程序在delphi 5上编译时也没有任何错误。我不知道确切的错误在哪里。当我按下ctrl+时,让鼠标键rom交互显示其重定向到crrect位置的信息。并错误地说出未声明的标识符。有没有可能是因为其他文件的原因导致了它的发生?纳伦,很难说。。。在发布随机问题之前,您必须尝试找到正确的问题,因为您是唯一可以访问源代码并且不想(或不能)发布真实代码的人。我不知道你的项目是什么样的,只是对可能发生的事情做一个有根据的猜测。
unit Unit2;
interface
uses winapi.Windows;
{$include abc.inc}
implementation
end.
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
type
TLocal = array[0..10] of Interace_Info;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
ALocal: TLocal;
begin
ALocal[0].iflag := 0;
ShowMessage(IntToStr(ALocal[0].iflag));
end;
end.