Import Problem

BlitzMax Forums/BlitzMax Programming/Import Problem

Serge(Posted 2005) [#1]
I have 2 following files:

TypeB.bmx:
Import "typeA.bmx"

Type typeB
  field pointer:typeA
EndType


TypeA.bmx:
import "typeB.bmx"

Type typeA
  field pointer:typeB
EndType


Like you see they have to import each other, but then I get an double declaration error.
Anyone have an idea how to handle it?


Beaker(Posted 2005) [#2]
Just Include *one* to the other:
include "typeA.bmx"

Type typeB
  Field pointer:typeA
EndType



N3m(Posted 2005) [#3]
i have got another problem with import.

i have three files: main.bmx, src/a.bmx, src/b.bmx

main.bmx
Import "src/a.bmx"
.
.
.



src/a.bmx
Import "src/b.bmx" 

Type TypeA
   Field bla:TypeB
.
End Type



src/b.bmx

Type TypeB
.
.
End Type


The problem is now that to compile src/a.bmx the import
command should look like this : Import "b.bmx"
but to compile main.bmx correctly it should be : Import "src/b.bmx"

So you can't use sources in other folders with bmax and thats not very good.


tonyg(Posted 2005) [#4]
? Why are you specifying import src/b.bmx rather than just b.bmx?


N3m(Posted 2005) [#5]
the problem is if u use import "src/b.bmx" blitzmax cannot compile a.bmx and if you use import "b.bmx" bmax cannot compile main.bmx

but they must bee compile both to link them together