Error Compiling Program (2018-04-03 02:48 by toml12953 #81022)
Tis program works in Decimal BASIC but gives an error when trying to compile it
DECLARE EXTERNAL FUNCTION F
INPUT PROMPT "Enter semimajor axis a: ":a
INPUT PROMPT "Enter semiminor axis b: ":b
INPUT PROMPT "Enter Theta0: ":theta0
INPUT PROMPT "Enter Theta1: ":theta1
LET S = F(a,b,Theta1) - F(a,b,Theta0)
PRINT "Area =";S
END
EXTERNAL FUNCTION F(a,b,t)
LET F = a*b/2*(t-ATN((b-a)*SIN(2*t)/(b+a+(b-a)*COS(2*t))))
END FUNCTION
The error is:
Free Pascal Compiler version 3.0.4 [2018/02/25] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
NoName.lpr(41,133) Fatal: Syntax error, ")" expected but "identifier S" found
Fatal: Compilation aborted
The Pascal line is:
init( true , false , false , false ,BMP801,17179869184,14,0,12,'Consolas',0,'D:\LANGS\BASICAcc2\My BASIC Programs\Area Using Kepler's Second Law',10);
Re: Error Compiling Program (2018-04-03 04:53 by toml12953 #81023)
[Reply To Message #81022]
> Tis program works in Decimal BASIC but gives an error when trying to compile it
>
> DECLARE EXTERNAL FUNCTION F
> INPUT PROMPT "Enter semimajor axis a: ":a
> INPUT PROMPT "Enter semiminor axis b: ":b
> INPUT PROMPT "Enter Theta0: ":theta0
> INPUT PROMPT "Enter Theta1: ":theta1
> LET S = F(a,b,Theta1) - F(a,b,Theta0)
> PRINT "Area =";S
> END
> EXTERNAL FUNCTION F(a,b,t)
> LET F = a*b/2*(t-ATN((b-a)*SIN(2*t)/(b+a+(b-a)*COS(2*t))))
> END FUNCTION
>
>
> The error is:
> Free Pascal Compiler version 3.0.4 [2018/02/25] for x86_64
> Copyright (c) 1993-2017 by Florian Klaempfl and others
> NoName.lpr(41,133) Fatal: Syntax error, ")" expected but "identifier S" found
> Fatal: Compilation aborted
>
> The Pascal line is:
> init( true , false , false , false ,BMP801,17179869184,14,0,12,'Consolas',0,'D:\LANGS\BASICAcc2\My BASIC Programs\Area Using Kepler's Second Law',10);
>
The problem seems to be with the apostrophe in the file name (Area Using Kepler's Second Law) When I removed it, the program compiled OK.