Forum
import confusion - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16)
+---- Thread: import confusion (/showthread.php?tid=472)



import confusion - slenkar - 06-28-2012

I like having my pathfinding code in a seperate file,
BUT the pathfinding code has to use an array from main.bas

I get error message saying
identifier 'UnitExists' is a function, not a var

but really its an array


I could put Dim UnitExists in the pathfinding.bas file

but what if another included file needs to reference UnitExists?

UnitExists needs to be 'global' somehow


Re: import confusion - boriel - 06-28-2012

The problem there is that UnitExist must be declared (included) before it's referenced for the 1st time.
Try to put the include at the beginning, and tell me.


Re: import confusion - slenkar - 04-11-2013

having problems with imports again
please download the project
<!-- m --><a class="postlink" href="http://www.4shared.com/zip/sBALDAkZ/wars.html">http://www.4shared.com/zip/sBALDAkZ/wars.html</a><!-- m -->

and compile wars.bas

it says the function findpath is not found but its in pathfinding.bas

also it says the error is in wars.bas on line 23

but its really in movingfunctions.bas


Re: import confusion - boriel - 04-14-2013

Apparently the file pathfind.bas is entirely commented, because it starts with a block comment /' at the beginning.
I tried closing that block comming just before the FindPath funcion declaration and your program was correctly compiled :!:

Included are done by the preprocessor. So you can always try
zxbpp wars.bas and see the resulting souce file, as a first test to discard posible mistakes before going further.

Try removing /' in the pathfinding.bas file and tell me. :roll:


Re: import confusion - slenkar - 04-14-2013

oh yeh it works now thanks!