Recent

Author Topic: Compilwe Error?  (Read 322 times)

JLWest

  • Hero Member
  • *****
  • Posts: 751
Compilwe Error?
« on: May 27, 2020, 03:19:55 am »
The  function "ProvCallNamePath" is declared and coded in Unit2, thus no TForm1.
When I call the function I get:
 
unit1.pas(722,43) Fatal: Syntax error, ";" expected but ":" found

There is a ';' terminating the call.

I can't see anything wrong with this.

Need help

Thanks


Code: Pascal  [Select][+][-]
  1.      function ProvCallNamePath(ALOC      : String;
  2.                                AMODE     : String;
  3.                                APROV     : String;
  4.                                ACALLNAME : String;
  5.                                ASub1     : String;
  6.                                ASub2     : String) : String;
  7.  
  8.  
  9.  
  10.  APath := ProvCallNamePath(LOC,
  11.                                          iMode,
  12.                                          VRCD.VProvider,
  13.                                          VRCD.VTheCallName,
  14.                                          VRCD.VSubSer1,
  15.                                          VRCD.VSubSer2) : String;       <-- Line Highlighted                                                                
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

Handoko

  • Hero Member
  • *****
  • Posts: 3543
  • My goal: build my own game engine using Lazarus
Re: Compilwe Error?
« Reply #1 on: May 27, 2020, 03:32:16 am »
This is yours:

APath := ProvCallNamePath(LOC,
                          iMode,
                          VRCD.VProvider,
                          VRCD.VTheCallName,
                          VRCD.VSubSer1,
                          VRCD.VSubSer2) : String;


It should be:

APath := ProvCallNamePath(LOC,
                          iMode,
                          VRCD.VProvider,
                          VRCD.VTheCallName,
                          VRCD.VSubSer1,
                          VRCD.VSubSer2);

JLWest

  • Hero Member
  • *****
  • Posts: 751
Re: Compilwe Error?
« Reply #2 on: May 27, 2020, 03:40:05 am »
But ProvCallNamePath is a function:

Unit2  declared:   function ProvCallNamePath(ALOC      : String;
                                                                  AMODE     : String;
                                                                  APROV     : String;
                                                                  ACALLNAME : String;
                                                                  ASub1     : String;
                                                                  ASub2     : String) : String;     
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

Handoko

  • Hero Member
  • *****
  • Posts: 3543
  • My goal: build my own game engine using Lazarus
Re: Compilwe Error?
« Reply #3 on: May 27, 2020, 03:42:02 am »
Have you tried my suggestion? Did you get any error using my suggestion?

TRon

  • Sr. Member
  • ****
  • Posts: 270
Re: Compilwe Error?
« Reply #4 on: May 27, 2020, 03:50:06 am »
unit1.pas(722,43) Fatal: Syntax error, ";" expected but ":" found
That is because you have jibberish located after your function call. Or to be more precise, your staetments starts with calling your function, then insert some jibberish to finally close the statement.

Quote
There is a ';' terminating the call.
You indeed have a ':' but before that you have written a type (string) a.k.a. jibberish  ;D

Quote
I can't see anything wrong with this.
Invoking a function does not allow you to specify the return type (as you seem to be doing in your second paste part).

You already have declared the return type of the function in the function declaration, so why would you do that again when actually calling the function ?

Handoko is 100% correct there, just in case you are still in limbo on that part :)
« Last Edit: May 27, 2020, 03:53:28 am by TRon »

JLWest

  • Hero Member
  • *****
  • Posts: 751
Re: Compilwe Error?
« Reply #5 on: May 27, 2020, 04:03:20 am »
Have you tried my suggestion? Did you get any error using my suggestion?

Yea. I just did and it compiled. Yea, I see it.

Thank you.
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