Recent

Author Topic: (Solved) probelm with ExtractFileName  (Read 396 times)

JLWest

  • Hero Member
  • *****
  • Posts: 987
(Solved) probelm with ExtractFileName
« on: November 14, 2020, 07:40:40 am »
Line 11 unit1.pas(1121,13) Error: Invalid assignment, procedures return no value
ExtractFileName is defined as a function
So what's happening here?

thanks

Code: Pascal  [Select][+][-]
  1. Type
  2.  uses ...StrUtils;
  3.  
  4.  
  5.  procedure TForm1.StripAndLoadLBX;
  6.    Var i : Integer;
  7.    Item : RawByteString;
  8.    begin        
  9.    for i := 0 to LBWork.Items.Count -1 do begin
  10.        Item := LBWork.Items[i];                                { 'D:\QL\doublex\ccompileroptions.txt'}
  11.        Item := ExtractFileName( Item );   {< Error Here}
  12.        Item := Copy2Symb( Item, '.' );
  13.        LBX.Items.ADD(Item);
  14.    end;
  15.   end;                                
  16. code]
« Last Edit: November 14, 2020, 05:45:26 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

howardpc

  • Hero Member
  • *****
  • Posts: 3608
Re: probelm with ExtractFileName
« Reply #1 on: November 14, 2020, 11:19:53 am »
Maybe somewhere in the units visible to TForm1 you have a procedure of your own which you have named ExtractFileName, which is clashing with the FPC function.

winni

  • Hero Member
  • *****
  • Posts: 2116
Re: probelm with ExtractFileName
« Reply #2 on: November 14, 2020, 11:45:27 am »
Hi!

Place your cursor exact on

 
Code: Pascal  [Select][+][-]
  1. ExtractFileName(

The type ALT  + CursorUp

The IDE should now show you the procedure which the compiler does not like.

Winni

wp

  • Hero Member
  • *****
  • Posts: 7948
Re: probelm with ExtractFileName
« Reply #3 on: November 14, 2020, 11:52:35 am »
Place your cursor exact on

 
Code: Pascal  [Select][+][-]
  1. ExtractFileName(

The type ALT  + CursorUp

The IDE should now show you the procedure which the compiler does not like.
It should be noted that this key combination does not work when the "classic" keyboard scheme is selected (like I did). What always seems to work is to press CTRL while clicking on an identifier.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

JLWest

  • Hero Member
  • *****
  • Posts: 987
Re: probelm with ExtractFileName
« Reply #4 on: November 14, 2020, 05:44:18 pm »
Thank yoi one and all/

 It was indeed a procedure name clash.

 
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