Delphi ошибка unsatisfied forward or external declaration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Menus;
 
 
type
  TForm1 = class(TForm)
    mm1: TMainMenu;
    edt1: TEdit;
    edt2: TEdit;
    rb1: TRadioButton;
    rb2: TRadioButton;
    rb3: TRadioButton;
    rb4: TRadioButton;
    rb5: TRadioButton;
    rb6: TRadioButton;
    rb7: TRadioButton;
    rb8: TRadioButton;
    btn1: TButton;
    btn2: TButton;
    btn3: TButton;
 
    procedure rb1Click(Sender: TObject);
    procedure rb2Click(Sender: TObject);
    procedure rb4Click(Sender: TObject);
    procedure rb3Click(Sender: TObject);
    procedure rb5Click(Sender: TObject);
    procedure rb6Click(Sender: TObject);
    procedure rb8Click(Sender: TObject);
    procedure rb7Click(Sender: TObject);
    procedure btn1Click(Sender: TObject);
    PROCEDURE DEC_to_P(const st:string;p:byte;Sender: TObject);
    FUNCTION  DEC_to_P0(const n:string;p:byte;Sender: TObject):string;
    PROCEDURE P_to_DEC(const n:string;p:byte;Sender: TObject);
    FUNCTION  P0_to_DEC(const n:string;p:byte;Sender: TObject):string;
    PROCEDURE BIN_to_OCT(const n:string;Sender: TObject);
    PROCEDURE BIN_to_HEX(const n:string;Sender: TObject);
    PROCEDURE OCT_to_BIN(const n:string;Sender: TObject);
    PROCEDURE HEX_to_BIN(const n:string;Sender: TObject);
    PROCEDURE OCT_to_HEX(const st:string;Sender: TObject);
    PROCEDURE HEX_to_OCT(const st:string;Sender: TObject);
    procedure Edt1KeyPress(Sender: TObject; var Key: Char);
    procedure btn2Click(Sender: TObject);
    procedure btn3Click(Sender: TObject);
 
 
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
  const
cod:array[0..15]of char=
 ('0','1','2','3','4','5','6','7','8','9','A','B','C','D',
  'E','F');
cod2:array[0..7]of string[3]=
 ('000','001','010','011','100','101','110','111');
cod3:array[0..15]of string[4]=
 ('0000','0001','0010','0011','0100','0101','0110','0111',
  '1000','1001','1010','1011','1100','1101','1110','1111');
 
  var
  Form1: TForm1;
    i:integer;
  tmp4:string;
  flag_clear:boolean;
 
 
implementation
 
{$R *.dfm}
 
 
FUNCTION IsFloatBIN(ch:char; st:string):char;
BEGIN
IsFloatBIN:=chr(0);
if (ch>='0')and(ch<='1')
  or(ch=#13)or(ch=#8) then IsFloatBIN:=ch;
 
case ch of
',': if (Pos(',',st) = 0)and(st[Length(st)]>='0') then IsFloatBIN:=ch;
end;
END;
 
FUNCTION IsFloatOCT(ch:char; st:string):char;
BEGIN
IsFloatOCT:=chr(0);
if (ch>='0')and(ch<='7')
  or(ch=#13)or(ch=#8) then IsFloatOCT:=ch;
 
case ch of
',': if (Pos(',',st) = 0)and(st[Length(st)]>='0') then IsFloatOCT:=ch;
end;
END;
 
FUNCTION IsFloatDEC(ch:char; st:string):char;
BEGIN
IsFloatDEC:=chr(0);
if (ch>='0')and(ch<='9')// Списала код Cyberforum!
  or(ch=#13)or(ch=#8) then IsFloatDEC:=ch;
 
case ch of
',': if (Pos(',',st) = 0)and(st[Length(st)]>='0') then IsFloatDEC:=ch;
end;
END;
 
FUNCTION IsFloatHEX(ch:char; st:string):char;
BEGIN
IsFloatHEX:=chr(0);
case ch of
'Ф','ф': ch:='A';
'И','и': ch:='B';
'С','с': ch:='C';
'В','в': ch:='D';
'У','у': ch:='E';
'А','а': ch:='F';
end;
if (ch>='0')and(ch<='9')
  or(upcase(ch)>='A')and(upcase(ch)<='F')
  or(ch=#13)or(ch=#8) then IsFloatHEX:=upcase(ch);
 
case ch of
',': if (Pos(',',st) = 0)and(st[Length(st)]>='0')then IsFloatHEX:=ch;
end;
END;
 
procedure TForm1.edt1KeyPress(Sender: TObject; var Key: Char);
begin
edt2.Text:='';
if key=#13 then
 begin
  btn1.SetFocus;
  exit;
 end;
if rb1.Checked then key:=IsFloatBIN(key,edt1.Text) else
if rb2.Checked then key:=IsFloatOCT(key,edt1.Text) else
if rb3.Checked then key:=IsFloatDEC(key,edt1.Text) else
if rb4.Checked then key:=IsFloatHEX(key,edt1.Text);
end;
 
procedure TForm1.rb1Click(Sender: TObject);
begin
rb5.Enabled:=false;
rb6.Enabled:=true;
rb7.Enabled:=true;
rb8.Enabled:=true;
if rb5.Checked then rb6.Checked:=true;
edt1.Text:='0';
edt1.SetFocus;
edt2.Text:='';
end;
 
procedure TForm1.rb2Click(Sender: TObject);
begin
rb5.Enabled:=true;
rb6.Enabled:=false;
rb7.Enabled:=true;
rb8.Enabled:=true;
if rb6.Checked then rb5.Checked:=true;
edt1.Text:='0';
edt1.SetFocus;
edt2.Text:='';
end;
 
procedure TForm1.rb4Click(Sender: TObject);
begin
rb5.Enabled:=true;
rb6.Enabled:=true;
rb7.Enabled:=true;
rb8.Enabled:=false;
if rb8.Checked then rb7.Checked:=true;
edt1.Text:='0';
edt1.SetFocus;
edt2.Text:='';
end;
 
procedure TForm1.rb3Click(Sender: TObject);
begin
rb5.Enabled:=true;
rb6.Enabled:=true;
rb7.Enabled:=false;
rb8.Enabled:=true;
if rb7.Checked then rb6.Checked:=true;
edt1.Text:='0';
edt1.SetFocus;
edt2.Text:='';
end;
 
procedure TForm1.rb5Click(Sender: TObject);
begin
edt1.SetFocus;
edt2.Text:='';
end;
 
procedure TForm1.rb6Click(Sender: TObject);
begin
edt1.SetFocus;
edt2.Text:='';
end;
 
procedure TForm1.rb8Click(Sender: TObject);
begin
edt1.SetFocus;
edt2.Text:='';
end;
 
procedure TForm1.rb7Click(Sender: TObject);
begin
edt1.SetFocus;
edt2.Text:='';
end;
 
PROCEDURE TForm1.DEC_to_P(const st:string;p:byte;Sender: TObject);
var
ost,tmp,tmp2,b:string;
d:longint;
e,c:integer;
BEGIN
if pos(',',st)=0 then
 begin
  d:=strtoint(st);
  ost:='';
 end else
 begin
  d:=strtoint(copy(st,1,pos(',',st)-1));
  ost:=copy(st,pos(',',st)+1,length(st)-pos(',',st));
 end;
 
 
end;
 
procedure TForm1.btn2Click(Sender: TObject);
begin
edt1.Clear;
edt2.Clear;
end;
 
procedure TForm1.btn3Click(Sender: TObject);
begin
Form1.Close;
end;
 
end.

Задача: При компиляции проекта возникает ошибка E2065 Unsatisfied forward or external declaration.
Инструментарий: Delphi
Решение:
При компиляции проекта появилась ошибка

[dcc32 Error] <Module Name>.pas(<Line Number>): E2065 Unsatisfied forward or external declaration: ‘<Class Name>.<Method Name>


Рассмотрим упрощенный вариант кода который привел к ошибке:


...
type
TA = class
public
procedure DoSomesting; // <= ошибка тут
end;

implementation

end.

В целом если рассмотреть упрощенны вариант все стает предельно ясно. Нет реализации для метода (в моем варианте это метод DoSomesting). Для решения проблемы — нужно добавить реализацию для метода.


...
type
TA = class
public
procedure DoSomesting;
end;

implementation

procedure TA.DoSomesting;
begin
//
end;

end.

PS: Для автоматической генерации метода в секции implementation можно воспользоваться сочетаем клавиш Ctrl+Shift+C. (Только сперва установите курсор в область описания класса). Если даже после автоматической генерации кода возникает та же ошибка — проверьте код, возможно у Вас используется конструкция {$IFDEF…}{$ELSE}{$ENDIF} и код попал в неиспользуемую секцию.

I am getting an error while compiling .pas file.

«unsatisfied forward or external declaration :TxxxException.CheckSchemeFinMethodDAException.»

Does anyone have any idea what this error implies?

Does it mean that
CheckSchemeFinMethodDAException was not called in all the concerned files?

Toby Allen's user avatar

Toby Allen

11k11 gold badges73 silver badges124 bronze badges

asked Aug 19, 2009 at 16:36

vas's user avatar

You have declared this method but didn’t implement it.

answered Aug 19, 2009 at 16:49

Uwe Raabe's user avatar

Uwe RaabeUwe Raabe

44.8k3 gold badges81 silver badges129 bronze badges

1

you may have forgotten to put the class name before the function name within the implementation section. for example, the following code will yield your error:

unit Unit1;

interface

type
  TMyClass = class
    function my_func(const text: string): string;
  end;

implementation

function my_func(const text: string): string;
begin
  result := text;
end;

end.

to fix, just change the function implementation to TMyClass.my_func(const text: string): string;.

answered May 23, 2013 at 9:03

mulllhausen's user avatar

mulllhausenmulllhausen

4,2057 gold badges48 silver badges71 bronze badges

unit Unit1;

interface

type
  TMyClass = class
    procedure DeclaredProcedure;
  end;

implementation

end.

This yields the error you describe. The procedure DeclaredProcedure is declared (signature) but not defined (implementation part is empty).

You have to provide an implementation for the procedure.

answered Aug 19, 2009 at 18:07

jpfollenius's user avatar

jpfolleniusjpfollenius

16.4k10 gold badges90 silver badges156 bronze badges

Go Up to Error and Warning Messages (Delphi)

This error message appears when you have a forward or external declaration of a procedure or function, or a declaration of a method in a class or object type, and you don’t define the procedure, function or method anywhere.

Maybe the definition is really missing, or maybe its name is just misspelled.

Note that a declaration of a procedure or function in the interface section of a unit is equivalent to a forward declaration — you have to supply the implementation (the body of the procedure or function) in the implementation section.

Similarly, the declaration of a method in a class or object type is equivalent to a forward declaration.

program Produce;

type
  TMyClass = class
  constructor Create;
  end;

function Sum(const a: array of Double): Double; forward;

function Summ(const a: array of Double): Double;
var
  i: Integer;
begin
  Result := 0.0;
  for i:= 0 to High(a) do
  Result := Result + a[i];
end;

begin
end.

The definition of Sum in the above example has an easy-to-spot typo.

program Solve;

type
  TMyClass = class
  constructor Create;
  end;

constructor TMyClass.Create;
begin
end;

function Sum(const a: array of Double): Double; forward;

function Sum(const a: array of Double): Double;
var
  i: Integer;
begin
  Result := 0.0;
  for i:= 0 to High(a) do
  Result := Result + a[i];
end;

begin
end.

The solution: make sure the definitions of your procedures, functions and methods are all there, and spelled correctly.

Delphi Compiler Error

E2065 Unsatisfied forward or external declaration ‘%s’

Reason for the Error & Solution

This error message appears when you have a forward or external declaration of a procedure or function, or a declaration of a method in a class or object type, and you don’t define the procedure, function or method anywhere.

Maybe the definition is really missing, or maybe its name is just misspelled.

Note that a declaration of a procedure or function in the interface section of a unit is equivalent to a forward declaration – you have to supply the implementation (the body of the procedure or function) in the implementation section.

Similarly, the declaration of a method in a class or object type is equivalent to a forward declaration.

program Produce;

type
  TMyClass = class
  constructor Create;
  end;

function Sum(const a: array of Double): Double; forward;

function Summ(const a: array of Double): Double;
var
  i: Integer;
begin
  Result := 0.0;
  for i:= 0 to High(a) do
  Result := Result + a[i];
end;

begin
end.

The definition of Sum in the above example has an easy-to-spot typo.

program Solve;

type
  TMyClass = class
  constructor Create;
  end;

constructor TMyClass.Create;
begin
end;

function Sum(const a: array of Double): Double; forward;

function Sum(const a: array of Double): Double;
var
  i: Integer;
begin
  Result := 0.0;
  for i:= 0 to High(a) do
  Result := Result + a[i];
end;

begin
end.

The solution: make sure the definitions of your procedures, functions and methods are all there, and spelled correctly.

  • Delphi ошибка stack overflow
  • Delphi ошибка list index out of bounds 0
  • Delphi ошибка for loop control variable must be simple local variable
  • Delphi ошибка e2033 types of actual and formal var parameters must be identical
  • Delphi ошибка could not compile used unit