Discussion:
Getting Build error
(too old to reply)
Sandeepan Kashyap
2014-09-24 12:35:39 UTC
Permalink
Hi all,

Since this afternoon, the below code was working fine. I guess, I tried playing with some Delphi editor settings and now it stopped running now. Please help me in fixing it.
I am getting below Compile errors, though it was working fine earlier.
Build
[Hint] Final.pas(40): Variable 'x' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(40): Variable 'y' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(41): Variable 'txt' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(42): Variable 'i' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(42): Variable 'j' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(42): Variable 'k' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(43): Variable 'Leng' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(44): Variable 'result' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(45): Variable 'TIntegerArray' is declared but never used in 'TForm1.Button1Click'
[Error] Final.pas(52): Declaration expected but identifier 'k' found
[Error] Final.pas(56): Undeclared identifier: 'TIntegerArray'
[Error] Final.pas(56): Undeclared identifier: 'j'
[Error] Final.pas(57): '.' expected but ';' found
[Error] Final.pas(59): Identifier redeclared: 'Finalization'
[Error] Final.pas(61): Undeclared identifier: 'i'
[Warning] Final.pas(62): Comparing signed and unsigned types - widened both operands
[Warning] Final.pas(65): Text after final 'END.' - ignored by compiler
[Error] Final.pas(21): Unsatisfied forward or external declaration: 'TForm1.Button2Click'
[Error] Final.pas(22): Unsatisfied forward or external declaration: 'TForm1.Edit2Change'
[Error] Final.pas(23): Unsatisfied forward or external declaration: 'TForm1.Button3Click'
[Fatal Error] FinalPRJ.dpr(6): Could not compile used unit 'Final.pas'

********************************Code**********************************


unit Final;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Label4: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure Button3Click(Sender: TObject);

private
{ Private declarations }
public
Test1: Integer;
end;

var
Form1: TForm1;

implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
x,y : integer;
txt: string;
i,j,k: integer;
Leng: integer;
result : string;
TIntegerArray : Array[1..100] of string;
begin
//SetLength(arrayOfIntegers, 19);
Form1.Color := clCream;
Test1 :=2;
end;
k := StrToInt(Edit1.Text);
{$R+} // Set range checking on
For j := 1 to k do
begin
TIntegerArray[j] := ' '+IntToStr(j); // ' ' to get the data in the next line
end;
For i := 1 to k do
begin
//ShowMessage('TIntegerArray['+IntToStr(j)+'] = '+TIntegerArray[j]);
If i = 1
then result := TIntegerArray[i]
else result := result + TIntegerArray[i];
//result := TIntegerArray[i]+ TIntegerArray[i]
end;

Label3.Caption := result+sLineBreak;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Form1.Color := clGray;
Button2.Enabled := True;
Edit1.Text := '';
Edit2.Text := '';
Label3.Caption := '';
end;

procedure TForm1.Edit2Change(Sender: TObject);
var
stringtwo : string;
j : integer;

begin
stringtwo := Edit2.Text;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
Form2.Show;
end;

end.
Sandeepan Kashyap
2014-09-24 12:55:55 UTC
Permalink
Please never mind.
end; should have been commented before cmd "k := StrToInt(Edit1.Text);. "
Post by Sandeepan Kashyap
Hi all,
Since this afternoon, the below code was working fine. I guess, I tried playing with some Delphi editor settings and now it stopped running now. Please help me in fixing it.
I am getting below Compile errors, though it was working fine earlier.
Build
[Hint] Final.pas(40): Variable 'x' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(40): Variable 'y' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(41): Variable 'txt' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(42): Variable 'i' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(42): Variable 'j' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(42): Variable 'k' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(43): Variable 'Leng' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(44): Variable 'result' is declared but never used in 'TForm1.Button1Click'
[Hint] Final.pas(45): Variable 'TIntegerArray' is declared but never used in 'TForm1.Button1Click'
[Error] Final.pas(52): Declaration expected but identifier 'k' found
[Error] Final.pas(56): Undeclared identifier: 'TIntegerArray'
[Error] Final.pas(56): Undeclared identifier: 'j'
[Error] Final.pas(57): '.' expected but ';' found
[Error] Final.pas(59): Identifier redeclared: 'Finalization'
[Error] Final.pas(61): Undeclared identifier: 'i'
[Warning] Final.pas(62): Comparing signed and unsigned types - widened both operands
[Warning] Final.pas(65): Text after final 'END.' - ignored by compiler
[Error] Final.pas(21): Unsatisfied forward or external declaration: 'TForm1.Button2Click'
[Error] Final.pas(22): Unsatisfied forward or external declaration: 'TForm1.Edit2Change'
[Error] Final.pas(23): Unsatisfied forward or external declaration: 'TForm1.Button3Click'
[Fatal Error] FinalPRJ.dpr(6): Could not compile used unit 'Final.pas'
********************************Code**********************************
unit Final;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Label4: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
Test1: Integer;
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
x,y : integer;
txt: string;
i,j,k: integer;
Leng: integer;
result : string;
TIntegerArray : Array[1..100] of string;
begin
//SetLength(arrayOfIntegers, 19);
Form1.Color := clCream;
Test1 :=2;
end;
k := StrToInt(Edit1.Text);
{$R+} // Set range checking on
For j := 1 to k do
begin
TIntegerArray[j] := ' '+IntToStr(j); // ' ' to get the data in the next line
end;
For i := 1 to k do
begin
//ShowMessage('TIntegerArray['+IntToStr(j)+'] = '+TIntegerArray[j]);
If i = 1
then result := TIntegerArray[i]
else result := result + TIntegerArray[i];
//result := TIntegerArray[i]+ TIntegerArray[i]
end;
Label3.Caption := result+sLineBreak;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Form1.Color := clGray;
Button2.Enabled := True;
Edit1.Text := '';
Edit2.Text := '';
Label3.Caption := '';
end;
procedure TForm1.Edit2Change(Sender: TObject);
var
stringtwo : string;
j : integer;
begin
stringtwo := Edit2.Text;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Form2.Show;
end;
end.
Loading...