在同一目录下有这样一个pas文件(test.pas):unit test;interfaceimplementationfunction MyTest(text:string):string;
begin
Result:=text;
end;end.
(不知道这样写有没有什么语法错误?)然后,我在一个工程中这样引用它:................
implementation
uses test;
.................之后,使用 MyTest() 函数就提示:
[Error] Unit1.pas(31): Undeclared identifier: 'MyTest'
[Fatal Error] Project1.dpr(7): Could not compile used unit 'Unit1.pas'或改成:................
interface
uses test;
.................也是同样的提示!怎么办呢?那为什么默认的 Windows,Message 等单元 Delphi 都通过,而我的单元却提示未申明???
begin
Result:=text;
end;end.
(不知道这样写有没有什么语法错误?)然后,我在一个工程中这样引用它:................
implementation
uses test;
.................之后,使用 MyTest() 函数就提示:
[Error] Unit1.pas(31): Undeclared identifier: 'MyTest'
[Fatal Error] Project1.dpr(7): Could not compile used unit 'Unit1.pas'或改成:................
interface
uses test;
.................也是同样的提示!怎么办呢?那为什么默认的 Windows,Message 等单元 Delphi 都通过,而我的单元却提示未申明???
function MyTest(text:string):string;
implementationfunction MyTest(text:string):string;
begin
Result:=text;
end;
还有就是
在interface处定义你的函数 function MyTest(text:string):string;