線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2262
推到 Plurk!
推到 Facebook!

增加function或procedure發生錯誤

尚未結案
deng0219
一般會員


發表:4
回覆:6
積分:2
註冊:2004-07-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-11-26 10:22:24 IP:218.167.xxx.xxx 未訂閱
unit Utility; interface uses SysUtils, Classes, StrUtils, DateUtils, DB; function myTrim(s : string) : string; function Fill(Val: String; Len: integer; FillChar: char): string; overload; function Fill(Val: String; Len: integer; FillChar: char;Pos:Boolean): string; overload; function Fill(Val: integer; Len : integer; FillChar : char): string; overload; function ConvertDate(strDate:string):String; function FillSpace(Text: String): String; function IsValidDBDateTime(aDateTime: TDateTime): boolean; function ReverseStr(S:string):string; function ReverseChStr(S:string):string; function GetMaxSupply(RankCode: String): Integer; function FontSizeControl(Str: String; StrFontSize, LinePutWord, MaxPutWord: Integer):Integer; function CheckString(Str: String):String; function CheckFiles: Strig; <--加了這行後就出現錯誤,不知道為什麼 procedure CopyDataSet(srcDataSet, destDataSet: TDataSet); implementation . . . . . 不加就不會出現錯誤.....真的很奇怪是為什麼呢??(加procedure也一樣) 錯誤訊息 Unsatisfied forward or external declaration: 'CheckFiles'
Zard
尊榮會員


發表:24
回覆:396
積分:539
註冊:2003-11-26

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-11-26 11:00:14 IP:210.243.xxx.xxx 未訂閱
引言: unit Utility; interface uses SysUtils, Classes, StrUtils, DateUtils, DB; function myTrim(s : string) : string; function Fill(Val: String; Len: integer; FillChar: char): string; overload; function Fill(Val: String; Len: integer; FillChar: char;Pos:Boolean): string; overload; function Fill(Val: integer; Len : integer; FillChar : char): string; overload; function ConvertDate(strDate:string):String; function FillSpace(Text: String): String; function IsValidDBDateTime(aDateTime: TDateTime): boolean; function ReverseStr(S:string):string; function ReverseChStr(S:string):string; function GetMaxSupply(RankCode: String): Integer; function FontSizeControl(Str: String; StrFontSize, LinePutWord, MaxPutWord: Integer):Integer; function CheckString(Str: String):String; function CheckFiles: Strig; <--加了這行後就出現錯誤,不知道為什麼 procedure CopyDataSet(srcDataSet, destDataSet: TDataSet); implementation . . . . . 不加就不會出現錯誤.....真的很奇怪是為什麼呢??(加procedure也一樣) 錯誤訊息 Unsatisfied forward or external declaration: 'CheckFiles'
宣告後若沒有實作該函式, 編譯器就會跳出這種警告訊息, 所以你至少要在implementation加上定義, 例如:

implementation
     .
     .
     .    function CheckFiles(): String;
begin
  Result := '';
end;    
deng0219
一般會員


發表:4
回覆:6
積分:2
註冊:2004-07-04

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-11-27 22:14:53 IP:218.169.xxx.xxx 未訂閱
unit Utility; interface uses SysUtils, Classes, StrUtils, DateUtils, DB, Registry; Function ZGetMyDocumentPath(): String; implementation Function ZGetMyDocumentPath(): String; begin with TRegistry.Create do begin try RootKey := HKEY_LOCAL_MACHINE; <--compiler後出現HKEY_LOCAL_MACHINE 沒有宣告 OpenKey('\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', True); Result := ReadString('Personal'); finally Free; end; end; end; 為什麼會出現我沒有宣告的問題......在繼承TForm的Unit就可以為什麼呢??
hahalin
版主


發表:295
回覆:1698
積分:823
註冊:2002-04-14

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-11-27 22:31:50 IP:218.170.xxx.xxx 未訂閱
因為registry只有windows才有,所以必須引用windows    uses SysUtils, Classes, StrUtils, DateUtils, DB,windows;
LargeWon
一般會員


發表:3
回覆:10
積分:2
註冊:2002-12-24

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-11-29 17:40:43 IP:211.162.xxx.xxx 未訂閱
function CheckFiles: Strig; <--加了這行後就出現錯誤,不知道為什麼 是否 function CheckFiles: String; //拼写错误 老王
------
老王
系統時間:2024-05-20 3:51:40
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!