Recent

Author Topic: [solved] how to fix the 'Error: Incompatible type...', on FindClose  (Read 1126 times)

CapelliC

  • Jr. Member
  • **
  • Posts: 58
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 ?
« Last Edit: July 07, 2020, 06:05:18 pm by CapelliC »

bytebites

  • Hero Member
  • *****
  • Posts: 633
Code: Pascal  [Select][+][-]
  1. SysUtils.FindClose(Res);

CapelliC

  • Jr. Member
  • **
  • Posts: 58
Many thanks, solved my problem.

 

TinyPortal © 2005-2018