Lazarus

Free Pascal => Beginners => Topic started by: CapelliC on July 07, 2020, 05:42:26 pm

Title: [solved] how to fix the 'Error: Incompatible type...', on FindClose
Post by: CapelliC on July 07, 2020, 05:42:26 pm
in this procedure
Code: Pascal  [Select][+][-]
  1.     procedure FindAll (const Path: String; Attr: Integer; List: TStringList);
  2.     var
  3.       Res: TSearchRec;
  4.       EOFound: Boolean;
  5.     begin
  6.      EOFound:= False;
  7.      if FindFirst(Path, Attr, Res) < 0 then exit
  8.      else
  9.        while not EOFound do
  10.        begin
  11.          if Res.Name<>'' then List.Add(Res.Name) ;
  12.          EOFound:= FindNext(Res) <> 0;
  13.        end;
  14.      FindClose(Res) ;
  15.     end;
  16.  

I get an error on  the res argument of FindClose:

a_file.pas(1419,19) Error: Incompatible type for arg no. 1: Got "TRawbyteSearchRec", expected "QWord".

Lazarus jumps into fileutilh.inc, where indeed there are the correct definitions. Then I guess that some different unit has redefined FindClose in incompabile way (I had to add to my slim projects some complex components...)

Is there a syntax to force the compiler to reference the fileutilh.inc ?
Title: Re: how to fix the 'Error: Incompatible type...', reported only on FindClose
Post by: bytebites on July 07, 2020, 05:47:16 pm
Code: Pascal  [Select][+][-]
  1. SysUtils.FindClose(Res);
Title: Re: how to fix the 'Error: Incompatible type...', reported only on FindClose
Post by: CapelliC on July 07, 2020, 06:04:36 pm
Many thanks, solved my problem.
TinyPortal © 2005-2018