Recent

Author Topic: What's Wrong with this?(Solved)  (Read 580 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1169
What's Wrong with this?(Solved)
« on: July 29, 2022, 11:36:52 pm »
I get an error on line 12. Don't see it;
Help please


Code: Pascal  [Select][+][-]
  1. type
  2.  procedure ErrorTList(Tag1, Msg: String);
  3.  
  4. implementation    
  5.  
  6. procedure TForm1.ErrorTList(Tag1, Msg: String);
  7.  Var i: Integer=0;
  8.   Conbined: String;
  9.   begin
  10.    Conbined:= Tag1 + ' ' + MSG;
  11.    EList.Add(Combined);   //<=  unit1.pas(2643,4) Error: Identifier not found "EList"
  12.   Inc(i);
  13.   end;
  14.  
  15. initialization
  16. EList := TStringList.create;
  17.  
  18. finalization
  19. EList.free;
  20. end.    

I needed something Global Var
« Last Edit: July 29, 2022, 11:43:06 pm by JLWest »
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Josh

  • Hero Member
  • *****
  • Posts: 996
Re: What's Wrong with this?(Solved)
« Reply #1 on: July 30, 2022, 12:54:56 am »
Hi

Sorry but cant test non compileable code...
what error if any are you getting?

Code: Pascal  [Select][+][-]
  1. procedure TForm1.ErrorTList(Tag1, Msg: String);
  2. Var i: Integer=0;
  3.    Conbined: String;
  4. begin
  5.   Conbined:= Tag1 + ' ' + MSG;
  6.   EList.Add(Combined);   //<=  unit1.pas(2643,4) Error: Identifier not found "EList"
  7.   Inc(i);
  8. end;

EList.Add(Combined); maybe mispelt as string is defined as Conbined

var i is not global but local to the procedure, so no idea why its used and what you are expecting?
« Last Edit: July 30, 2022, 12:59:13 am by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

wildfire

  • Jr. Member
  • **
  • Posts: 92
Re: What's Wrong with this?(Solved)
« Reply #2 on: July 30, 2022, 01:02:02 am »
Hi

Sorry but cant test non compileable code...
what error if any are you getting?

OP has referenced it as a comment in the source.

Quote
Code: Pascal  [Select][+][-]
  1. procedure TForm1.ErrorTList(Tag1, Msg: String);
  2. Var i: Integer=0;
  3.    Conbined: String;
  4. begin
  5.   Conbined:= Tag1 + ' ' + MSG;
  6.   EList.Add(Combined);   //<=  unit1.pas(2643,4) Error: Identifier not found "EList"
  7.   Inc(i);
  8. end;

cant see a problem with code...

EList not being declared appears to have been the problem and JLWest appears to have acknowledged it, hence marked solved.
Windows 10 64bit version 1809
Laz 2.0.0 FPC 3.0.4

JLWest

  • Hero Member
  • *****
  • Posts: 1169
Re: What's Wrong with this?(Solved)
« Reply #3 on: July 30, 2022, 08:45:45 pm »
@Wildfile - Correct
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018