Recent

Author Topic: Error: Can't determine which overloaded function to call  (Read 11641 times)

geanmyboy

  • Newbie
  • Posts: 4
Error: Can't determine which overloaded function to call
« on: March 01, 2010, 07:04:05 pm »
Hey Dude's ..

I'm porting one of mine app written in delphi to lazarus, and till now it's going well. I stop here at this problem.

I'm Trying to use the function Pos that probably at systemh.inc .

This is the command that i'm using :

 
Code: [Select]
if Pos(Campo[z],'_')<>0 Then
In Delphi it goes well. Can somebody tells me where i'm mistaking ?

Version #: 0.9.28.2 beta
Date: 2009-10-25
FPC Version: 2.2.4
SVN Revision: 22279
I386-win32-win32/win64

untfuncoes.pas(466,10) Error: Can't determine which overloaded function to call
untfuncoes.pas(494) Fatal: There were 2 errors compiling module, stopping

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1945
Re: Error: Can't determine which overloaded function to call
« Reply #1 on: March 01, 2010, 10:35:25 pm »
In case there is another pos function around in some unit try:
System.Pos();
Or what is "Campo"?

geanmyboy

  • Newbie
  • Posts: 4
Re: Error: Can't determine which overloaded function to call
« Reply #2 on: March 02, 2010, 01:11:00 pm »
I'm from Brazil, a right translation for Campo is Field. This is one of my variables.

Campo:String;

I need to check in what position i can found the underline character ( '_' ).

What Theo Said doesn't work. There is no Pos At System.

I Was thinking about change the code to Support the PosEx Function. That one probably will work.

Thanks Theo ...

If someone can help, I appreciate.

[]'s

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12291
  • Debugger - SynEdit - and more
    • wiki
Re: Error: Can't determine which overloaded function to call
« Reply #3 on: March 02, 2010, 01:49:54 pm »
 if Pos(Campo[z],'_')<>0 Then

You are searching for the occurrence of a char ( Campo[z] is a char ), in another char ( '_' is a char too; yes it could be treated as a string, but probably is treaded as char).

the error is probably, because pos expects a string as 2nd arg. Maybe a case for the fpc mailing list. Maybe it can be added to the rtl?

Anyway, in your case:
 if Campo[z] = '_' Then



 

TinyPortal © 2005-2018