Recent

Author Topic: (Solved)Need Help Can't Get this to compile and don't understand why.  (Read 387 times)

JLWest

  • Hero Member
  • *****
  • Posts: 934
I don't understand it Can soeone take a look please.

Generates compile time error: unit1.pas(42,14) Error: Identifier not found "ARESTCall"

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5.   Buttons,   Classes,  Clipbrd,      Controls,  Crt,
  6.   DateUtils, Dialogs,  ExtCtrls,     Forms,     Graphics,  StdCtrls,
  7.   StrUtils,  SysUtils, FileUtil,     ComCtrls,
  8.   opensslsockets,      fphttpclient, fpjson,    jsonparser;
  9. type
  10.    { TForm1 }
  11.   TForm1 = class(TForm)
  12.     btnQuit: TButton;
  13.     btnSaveICAOIATAAIRLINES: TButton;
  14.     Button1 : TButton;
  15.     Edit6   : TEdit;
  16.     Edit8   : TEdit;
  17.     ListBox3: TListBox;
  18.  
  19.  
  20.   private
  21.    function ARESTCall(ACALL    : string;
  22.                    SaveToFile  : boolean;
  23.                       Filename : string   ): string;
  24.    public
  25.   end;
  26. var
  27.   Form1   : TForm1;
  28.  
  29. implementation
  30.  uses LCLType;
  31. {$R *.lfm}
  32. { TForm1 }
  33.  
  34.  procedure CIRUMcarrierCall(AName : String);
  35.   Var Carrier : String = '';
  36.     XCall : String = '';
  37.     STF   : Boolean = False;
  38.     FName : String = '';
  39.     GCall : AnsiString = '';
  40.    begin
  41.     Carrier := AName;
  42.     GCALL := ARESTCall(XCALL,STF,Fname);   {[color=red]<===  Generated compile error.[/color]  }
  43.    end;
  44.  
  45.  function TForm1.ARESTCall(ACALL : string; SaveToFile: boolean; Filename: string): string;
  46.   var TheReturn : AnsiString = '';
  47.    i : Integer = -1;
  48.   begin
  49.    Result := 'Nil';
  50.      With TFPHttpClient.Create(Nil) do
  51.      try
  52.       try
  53.        TheReturn := Get(ACALL);
  54.       if SaveToFile then begin
  55.          i := i;
  56.       end;
  57.       Result := TheReturn;
  58.       except on btnParse: Exception do  ShowMessage('Error: ' + btnParse.Message);
  59.      end;
  60.     finally
  61.      Free;
  62.     end;
  63.    end;
  64.  
  65.  end.
  66.  
« Last Edit: October 23, 2020, 01:13:15 am 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

bytebites

  • Sr. Member
  • ****
  • Posts: 345
Re: Need Help Can't Get this to compile and don't understand why.
« Reply #1 on: May 03, 2020, 05:00:19 am »
Add CIRUMcarrierCall to TForm1-class
Code: Pascal  [Select][+][-]
  1.  procedure TForm1.CIRUMcarrierCall(AName : String);

JLWest

  • Hero Member
  • *****
  • Posts: 934
Re: Need Help Can't Get this to compile and don't understand why.
« Reply #2 on: May 03, 2020, 06:26:16 am »

Yes Of course. but I also needed to post which was missing.

 procedure CIRUMcarrierCall(AName : String);

Thank you
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

jamie

  • Hero Member
  • *****
  • Posts: 3797
Re: Need Help Can't Get this to compile and don't understand why.
« Reply #3 on: May 03, 2020, 01:35:29 pm »
if you didn't or don't want to add that to the form you can still call a form method for a return but you need to prepend the form instance..

Code: Pascal  [Select][+][-]
  1.  GCALL := form1.ARESTCall(XCALL,STF,Fname);  
  2.  
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018