* * *

Author Topic: Error: Operator is not overloaded  (Read 2031 times)

IndianaJones

  • Sr. Member
  • ****
  • Posts: 408
Error: Operator is not overloaded
« on: December 07, 2011, 02:55:32 pm »

Hi all,
Can someone explain what this error mean?
I have an equation like this, rel:=xy*(avalue[0] / avg);
That statement look fine to me but I cant figure it out?
Thanks.

Blaazen

  • Hero Member
  • *****
  • Posts: 836
Re: Error: Operator is not overloaded
« Reply #1 on: December 07, 2011, 03:21:38 pm »
Quote
I have an equation like this, rel:=xy*(avalue[0] / avg);
That statement look fine to me but I cant figure it out?

Yes, it looks fine.
But important are types (declarations) of rel, xy, avalue[] and avg.
Lazarus 0.9.31 r37217M FPC 2.5.1 r21251 x86_64-linux-qt/gtk2

Ramijami

  • New member
  • *
  • Posts: 45
Re: Error: Operator is not overloaded
« Reply #2 on: December 16, 2011, 06:03:18 pm »
I get the same error message and it points to this line of code:

Code: [Select]
if StaticFail> MaxFF then PassAll := 1;

It seems to point to the (>) not being"overloaded". Does anyone know what this means and how I fix the error? I have no idea what "overloaded" refers to and searching hasn't given any explanation a novice can understand  :(

typo

  • Hero Member
  • *****
  • Posts: 1368
Re: Error: Operator is not overloaded
« Reply #3 on: December 16, 2011, 06:16:47 pm »
You need to provide enough information about these identifiers.

Ramijami

  • New member
  • *
  • Posts: 45
Re: Error: Operator is not overloaded
« Reply #4 on: December 17, 2011, 11:18:03 am »
Hi typo,

StaticFail is a basic counter that counts whether a certain comparison in a procedure passes or not, while MaxFF is what the user selects to set as maximum via a TEdit box.......both are integer type identifiers. I'm trying to understand what the purpose of "overload" is and how it relates to a seemingly simple comparison process. The explanation in the Free Pascal Referance guide has left me even more confused

IndianaJones

  • Sr. Member
  • ****
  • Posts: 408
Re: Error: Operator is not overloaded
« Reply #5 on: December 17, 2011, 11:48:03 am »

Have you ever use any dynamic array and setlength command in your programme?

Bart

  • Hero Member
  • *****
  • Posts: 791
    • Bart en Mariska's Webstek
Re: Error: Operator is not overloaded
« Reply #6 on: December 17, 2011, 11:49:42 am »
StaticFail is a basic counter that counts whether a certain comparison in a procedure passes or not, while MaxFF is what the user selects to set as maximum via a TEdit box.......both are integer type identifiers.

Please create an minmal testcase exampple where the error occurs and attach it.
Without the actual code we can only guess.

Bart

Blaazen

  • Hero Member
  • *****
  • Posts: 836
Re: Error: Operator is not overloaded
« Reply #7 on: December 17, 2011, 01:10:35 pm »
Code: [Select]
if StaticFail> MaxFF then PassAll := 1;@ Ramijami
Are you sure that error message is related to ">" ? It can be related to ":=" as well. What type is "PassAll" ?
Lazarus 0.9.31 r37217M FPC 2.5.1 r21251 x86_64-linux-qt/gtk2

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1182
Re: Error: Operator is not overloaded
« Reply #8 on: December 17, 2011, 08:18:19 pm »
Hi typo,

StaticFail is a basic counter that counts whether a certain comparison in a procedure passes or not, while MaxFF is what the user selects to set as maximum via a TEdit box......

So the types of both MaxFF and StaticFail are integer ?

Ramijami

  • New member
  • *
  • Posts: 45
Re: Error: Operator is not overloaded
« Reply #9 on: December 17, 2011, 10:05:04 pm »
While doing a test example to post as requested by Bart I remembered that the free pascal reference referred to "two types" so thought I'd check to see if I used any of the Identifiers more than once. Found a similar "MaxFF" as the name of a textbox and changed it.......seems to have solved the problem (at least I'm not getting the error anymore). Thanks for the help, and my apologies for wasting your time on such a simple mistake on my part  :-[

lampuiho

  • Newbie
  • Posts: 2
Re: Error: Operator is not overloaded
« Reply #10 on: February 22, 2012, 04:44:46 am »
I'm getting the same error for the following code:

  for i:=2 to f.size-1 do
    m:=m xor m[i-2];

m is pbytearray pointing to f

any help would be appreciated

Martin_fr

  • Hero Member
  • *****
  • Posts: 1218
Re: Error: Operator is not overloaded
« Reply #11 on: February 22, 2012, 01:06:54 pm »
Hi typo,

StaticFail is a basic counter that counts whether a certain comparison in a procedure passes or not, while MaxFF is what the user selects to set as maximum via a TEdit box.......both are integer type identifiers. I'm trying to understand what the purpose of "overload" is and how it relates to a seemingly simple comparison process. The explanation in the Free Pascal Referance guide has left me even more confused

MaxFF is declared as

  MaxFF: Integer ?

or as
  MaxFF: TEdit

the 2nd will not work. You can not use an object here.
yuo can get the TEXT via MaxFF.Text, and then need a StrToInt() to make it integer


User137

  • Hero Member
  • *****
  • Posts: 503
Re: Error: Operator is not overloaded
« Reply #12 on: February 22, 2012, 04:18:33 pm »
I'm getting the same error for the following code:
Code: [Select]
  for i:=2 to f.size-1 do
    m[i]:=m[i] xor m[i-2];
m is pbytearray pointing to f
Just quoting with code tags, to show what it looks like without forum changing it italic. I can't see what's wrong with the code. Maybe elsewhere? Can you try PByte instead of PByteArray?

I mean, my texture class has IFDEF so that same code works with Delphi and Lazarus. PByte is fpc way of things:
Code: [Select]
    {$IFDEF fpc}
    Data: PByte;
    {$ELSE}
    Data: PByteArray;
    {$ENDIF}
« Last Edit: February 22, 2012, 04:20:30 pm by User137 »

lampuiho

  • Newbie
  • Posts: 2
Re: Error: Operator is not overloaded
« Reply #13 on: February 23, 2012, 05:17:26 am »
Just quoting with code tags, to show what it looks like without forum changing it italic. I can't see what's wrong with the code. Maybe elsewhere? Can you try PByte instead of PByteArray?
oh that works!! Thanks a lot

But some clarification of the difference between them would be great

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads