Print Topic - Archive

XBLite Forum  /  XBLite Programming  /  First program :(
Posted by: sospel, August 19, 2008, 2:46pm
Hi All !

I downloaded XBLITE one week ago, to know the possibilities of this language.
I respected the councils of installation, and the examples of the demo work very well.
But from my first one little essay (see listing below), I have error messages:
--------------------------------------------------------------------------
F:\XBasic\Developpement\test1.x(3) : Program Name Mismatch(9)
F:\XBasic\Developpement\test1.x(13): Undeclared( 8 )
F:\XBasic\Developpement\test1.x(15): Undeclared( 8 )
> Done. Compiled file in 16 msec
***** ERRORS =  3 *****
> Execution finished.
---------------------------------------------------------------------------
I do not understand why my " program name " is false and why the mathematical functions are not found.
I nevertheless copied a part of the program " eval.x " in " XbLite\Programme\xblite\demo\console\ev al\eval.x ", which operate very well when I launch it!
Then, big thank if somebody could say to me where are my errors!
Cordially

My program :
============
'
PROGRAM "maths"
'
CONSOLE
IMPORT "xma_s.lib"
'
DECLARE FUNCTION Entry ()

FUNCTION Entry ()
DOUBLE root,pi,sine
root = sqrt(2.00)
PRINT " ==> result = ";root
pi = 3,1415926535
sine = sin(pi)
PRINT " ==> result = ";sine
a$ = INLINE$ ("press a key to continue >")
END FUNCTION

END PROGRAM
Posted by: 26 (Guest), August 20, 2008, 5:58am; Reply: 1
Quoted Text
F:\XBasic\Developpement\test1.x(3) : Program Name Mismatch(9)

The file name of your program.x must match with name declared in PROGRAM.So if you save your .x code with the name 'test1' the line must become PROGRAM "test1"

Quoted Text
F:\XBasic\Developpement\test1.x(13): Undeclared( 8 )
F:\XBasic\Developpement\test1.x(15): Undeclared( 8 )


The first letter of sin and sqrt must be uppercase :
Quoted Text

root = Sqrt(2.00)
...
sine = Sin(pi)

Posted by: sospel, August 20, 2008, 8:16am; Reply: 2
Thanks to FANO !
Now, my program run, and I can make more sophisticated tests :))
sospel
Posted by: 13 (Guest), August 21, 2008, 12:55pm; Reply: 3
Note also that the PROGRAM statement is optional, except in the case of creating libraries.  However, if the PROGRAM statement is used, it must match the filename.

See the documentation for PROGRAM.

Greg
Posted by: 17 (Guest), August 22, 2008, 10:02am; Reply: 4
Hi Greg,

My experience with "Program Name Mismatch(9)" is that the compiler still generates a working exe. I would say that it's just a compile warning.

However, why take a chance there?
- Either you don't use the PROGRAM statement,
- or you use it properly.

Bye! Guy
Print page generated: February 5, 2012, 2:44pm