帮忙看看这个无窗体的单元中的错误!

big_net 2002-05-06 06:03:16
unit Unit_public;

interface
function autoinde(var SerialNumber:string):string;
implementation
{$R *.DFM}
function autoinde(var SerialNumber:string):string;
var
//存储编号
year,month,day:word;
Str_month:string;
Str_day:string;
begin
decodedate(now,year,month,day);
if month<10 then//如果月份的数据的位数为1则在数字的前面加0
begin
Str_month:='0'+inttostr(month);
end;
if day<10 then//如果日期的数据的位数为1则在数字的前面加0
begin
Str_day:='0'+inttostr(day);
end;
randomize;
SerialNumber:=inttostr(year)+Str_month+Str_day+copy(floattostr(random),3,4);
end;
end.
===============
备注:我在一个公共的无窗体的单元中写个随机编号的函数供其他的单元调用,但老是出错,帮忙看看!顺便提点意见~~
错误信息:
[Warning] Unit_public.pas(6): File not found: 'Unit_public.DFM'
[Error] Unit_public.pas(14): Undeclared identifier: 'decodedate'
[Error] Unit_public.pas(14): Undeclared identifier: 'now'
[Error] Unit_public.pas(17): Undeclared identifier: 'inttostr'
[Error] Unit_public.pas(24): Undeclared identifier: 'floattostr'
[Error] Unit_public.pas(24): Incompatible types
[Fatal Error] qunguan.dpr(83): Could not compile used unit 'unit\Unit_public.pas'
最好能说一下错误的原因,谢谢!!!

...全文
45 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
BEYONDcsharp 2002-05-07
  • 打赏
  • 举报
回复
同意楼上!
>>{$R *.DFM}
是要编译同名的窗体文件'Unit_public.DFM'
没有窗体就去掉,看看

你几个函数 (如:decodedate,now等)没有引用相应的单元文件.当然没有定义了
就会出错.
在interface上
uses windows.....
(引用相应的单元文件 )

lizhenjia 2002-05-06
  • 打赏
  • 举报
回复
uses SysUtils就好了!
youou 2002-05-06
  • 打赏
  • 举报
回复
同意楼上的!




wzrlover 2002-05-06
  • 打赏
  • 举报
回复
>>{$R *.DFM}
是要编译同名的窗体文件'Unit_public.DFM'
没有窗体就去掉,看看

你几个函数 (如:decodedate,now等)没有引用相应的单元文件.当然没有定义了
就会出错.
在interface上
uses windows.....
(引用相应的单元文件 )

5,930

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧