|
Post by u9 on Aug 25, 2007 8:17:24 GMT -5
one cannot use option explicit when using several files, because the program doesn't work when compiled. If i run the compiled version i get this error:
title: Stub Message: Run-time error '1024': Expected statement
I mean, that i can only have option explicit in the first file, but that doesn't matter for the other files that get included. There is no need to declare (dim) variables in these files. If i write "option explicit" in all the files, then i get the above error when compiled.
|
|
|
Post by Guilect on Aug 25, 2007 12:32:47 GMT -5
"when using several files", implies use of the "include" command. The include command inserts the included file in the position of the include command in the file that is calling it. VBScript does not natively have an "include" function. B2D has added that to extend the programming language's capabilities. VBScript was never made to see "Option Explicit" more than once. So when VBScript sees a command that is to be used only once, used more than once it puts up and error. Your best bet would be to use Option Explicit in each of your files. Run each file by itself to see if any error are generated. When the file looks good, comment out the extra Option Explicits. Should I move this to the "Tips" forum.
|
|
|
Post by u9 on Sept 1, 2007 10:19:58 GMT -5
This is useless if one is making classes or functions because the undimensioned variables will not be noticed until program execution reaches this point. If the file does not contain functions or classes, then chances that it can even run by itself and not rely on some previously defined/executed code are slim.
One solution could be to compile the program before running every time. This will also lessen the difference-gap that is between running from IDE and running the compiled. The drawback is that it will take much longer to try out small changes one makes.
|
|